2466 Commits

Author SHA1 Message Date
copilot-swe-agent[bot] 0d0f00d599 Initial plan 2026-02-25 16:20:23 +00:00
Renáta Hodován b7069350c2 cmake: avoid Apple ranlib flags when not using AppleClang (#5258)
On macOS, `-no_warning_for_no_symbols -c` options are specific to the
Apple `ranlib` tool. When using other toolchains (e.g. Homebrew clang),
these flags cause errors since `llvm-ranlib` does not recognize them.

The patch ensures these flags are only passed when using AppleClang.

JerryScript-DCO-1.0-Signed-off-by: Renata Hodovan reni@inf.u-szeged.hu
2025-10-08 19:35:32 +02:00
Roland Takacs 355ab24cdc Bump RIOT target to 25.04 (#5231)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2025-06-03 13:04:20 +02:00
László Langó 50200152fe Update the README.md for release 3.0 (#5200)
JerryScript-DCO-1.0-Signed-off-by: Laszlo Lango laszlo.lango@h-lab.eu
2024-12-18 11:36:32 +01:00
László Langó 4cda596060 Updated the "Getting Started" and "Migration Guide" for the 3.0 release (#5202)
JerryScript-DCO-1.0-Signed-off-by: Laszlo Lango laszlo.lango@h-lab.eu
2024-12-18 11:28:38 +01:00
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 a1e4bd859e 02.API-REFERENCE.md format the *Note*: (#5195)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-12-17 10:20:20 +01:00
Yonggang Luo f322f603f5 Fixes nuttx target warning (#4984)
The warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-12-17 10:17:57 +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 77c72d4da7 docs: Fixes test code (#5193)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-12-17 09:43:35 +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
Gergo Csizi 718a439db1 Fix some style issues in debugger documentation (#5181)
There was some style issues in debugger documentation.
This patch fixes these issues.

JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-12-12 20:44:36 +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 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 b3fa5e0e03 Add missing configuration information to CONFIGURATION.md (#5183)
There was some missing configuration options in the CONFIGURATION documentation.
This patch adds these missing configurations.

JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-11-29 15:26:10 +01:00
Gergo Csizi 0b1d75a7db Update and fix some issues in EXT-REFERENCE documentation (#5180)
There was some issues and typos in the EXT-REFERENCE documentation.
This patch fixes these issues and typos.

JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-11-28 13:35:19 +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
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
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
Yonggang Luo 82ca949850 Update document 10.EXT-REFERENCE-HANDLER.md (#5163)
The handler prototype did not match it's implementation

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-11-20 17:46:10 +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
Robert Sipka 38e05b4569 Minor fix to ensure Python 3 support in the debugger (#5168)
The default value for length in to_bytes was added in Python version 3.11.
This small fix ensures the compatibility with older Python3 versions.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka robert.sipka@h-lab.eu
2024-11-15 14:35:24 +01:00
Yonggang Luo d2e0d71101 Revise implementation of jerry_port_get_local_time_zone_adjustment on Win32 (#4589)
Handle the limitation of Win32 date API properly.

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-11-14 13:38:46 +01:00
Yonggang Luo 43f5026eb2 Add testcase that cleanup error throw from javascript properly. (#4581)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-11-12 21:24:35 +01:00
Yonggang Luo 3f314f387d Fixes unit-test-date-helpers failure on win32 (#4654)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-11-12 13:39:00 +01:00
László Langó bd0d391ee3 Fixes the GH actions by resolving the deprecated API usage. (#5160)
JerryScript-DCO-1.0-Signed-off-by: Laszlo Lango laszlo.lango@h-lab.eu
2024-11-07 10:07:57 +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
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
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 35465ed78e Fix CI for macos (#5142)
Due to compiler bugs present in the latest version of clang on macos:

Roll back macos version used by github actions from `macos-latest`
(`macos-14`) to `macos-13`: Some modulo operations were failing,
such as `-1 % -1` when compiler optimizations were enabled

Disable `-Wliteral-range` for test-math.c on macos, because it was
falsely raised for `isnan`, `isinf`, and `isfinite ` macros.

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2024-05-24 18:34:26 +02:00
Renáta Hodován 47bd5d4b91 Fix typo in the CMake setup of libFuzzer (#5136)
JerryScript-DCO-1.0-Signed-off-by: Renata Hodovan reni@inf.u-szeged.hu
2024-04-09 10:05:11 +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 514fa6735a Update MbedOS, RIOT and ESP_IDF CI checkers (#5120)
Update MbedOS and RIOT CI checkers to use `gcc-arm-none-eabi` on top of
ubuntu-latest

Upgrade to mbed-tools and mbed-os 6.17

Bump xtensa version to `2021r2-patch5` and re-enable `ESP_IDF_Build_Test`

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2023-12-15 12:12:59 +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
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
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
Roland Takacs 1a2c04763a Ensure command prompt is displayed when REPL is used (#5033)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2023-01-09 14:28:34 +01:00
Csaba Osztrogonác f5a8dc02b4 Fix failing CI jobs (#5032)
Test262 test runner needs python2, we need to install it manually on Ubuntu 22.04.
Disable ESP_IDF_Build_Test CI job temporarily, because it is broken.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2023-01-04 13:09:24 +01: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
Zoltan Herczeg 3360e352bf Fix exception printing. (#5012)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-08-08 08:14:37 +02:00
Gergo Csizi baf308a7ae Fix ESPIDF_Build_Test (#5019)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2022-08-01 22:10:42 +02:00
Roland Takacs 0d49696618 Merge esp8266-rtos-sdk and esp-idf targets (#4958)
This patch bumps esp8266-rtos-sdk to the latest release. This required to
modify the directory structure and the build system to conform to ESP-IDF
Style. Since esp-idf target already supports ESP-IDF Style, the espressif
targets has been merged to eliminate code duplication.
The target application code has been modified from blinking leds to hello
world to be aligned to other targets.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
2022-02-22 10:58:18 +01:00
Roland Takacs c9e9f8e818 Add support for Mbed-OS 6.15.0 (#4909)
The default Mbed OS device (STM32F4) had been changed to FRDM-K64F that is
supported by both Mbed OS 5 and Mbed OS 6 versions. Makefile had also been
modified to have a flash recipe.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
2022-02-22 10:29:07 +01:00
Yonggang Luo d00f4810b0 Fix import paths in negative module tests (#4973)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2022-02-03 11:36:39 +01: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
Robert Fancsik aead4b79a9 Fix format string in main-benchmark.c (#4970)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-20 19:50:23 +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
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
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
Csaba Osztrogonác 5467ac4608 Fix RIOT CI job (#4962)
Use https instead of the unsupported git protocol.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2022-01-11 11:03:44 +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
Robert Fancsik 6efe14d1bd Add missing object types for ecma_object_get_class_name (#4954)
This patch fixes #4937 and fixes #4938.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-10 16:37:35 +01:00
mnegyokru 58e504f1f4 Add stack-overflow check for general [[Construct]] method of function objects (#4945)
This patch fixes #4901

JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru negyokru@inf.u-szeged.hu
2022-01-10 16:27:39 +01:00
mnegyokru f3a420b672 Fix class static block opening brace parsing (#4942)
The next character should not be consumed after finding the static block opening brace.
This patch fixes #4916.

JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru negyokru@inf.u-szeged.hu
2022-01-10 14:53:04 +01:00
Roland Takacs 69f30977d9 Remove curie-bsp target (#4960)
Intel Corporation has announced the timeline for End of Life status for
Intel Curie Module (Intel Quark SE SoC) products.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
2022-01-10 14:31:23 +01:00
Virag Orkenyi 49a1a80aa8 Clean up Math builtin max,min and hypot methods (#4904)
Nan_found, Inf_found variables and ecma_is_value_number check have been deleted.

JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2022-01-03 11:14:23 +01:00
batizdaniel a6ab5e9abe Fix runtime error: left shift (#4912)
This patch fixes #4703
This patch fixes #4702

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz daniel.batiz@h-lab.eu
2021-12-23 11:33:21 +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
mnegyokru 077eaeb4e7 Update build profile to es.next on esp8266 (#4913)
- fix amalgam build issue with es.next profile
  - update esp linker script according to: Table 4-1. in
    https://www.espressif.com/sites/default/files/documentation/2a-esp8266-sdk_getting_started_guide_en.pdf

JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru negyokru@inf.u-szeged.hu
2021-12-23 11:30:19 +01:00
batizdaniel 26c6031530 Fix class literal scan (#4906)
This patch fixes #4892

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz daniel.batiz@h-lab.eu
2021-12-22 14:50:46 +01:00
Szilagyi Adam 53b61c1f6f Implement ECMAScript 2022 class static block (#4841)
Co-authored-by: Martin Negyokru negyokru@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2021-12-15 15:45:53 +01:00
Roland Takacs c51b268276 Minimize mbedos5 target (#4905)
* Removed hardware specific implementations
  * Added simple 'hello world' demo code to be aligned to other targets
  * Added ability to use external resources from outside JerryScript folder

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
2021-12-15 12:52:40 +01:00
Szilagyi Adam d650390e47 Fix redeclaration related eval corner cases (#4886)
- Fix cases where a function parameter binding is redeclared inside a parameter initializer eval
- Fix cases where a let- or function arguments binding is redeclared inside a function block because
  there is a declaration in a function parameter initializer eval
- Also remove the ECMA_PARSE_CHAIN_INDEX_SHIFT macro, added a debugger_eval_chain_index named field to the jerry context instead

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2021-12-15 12:45:10 +01:00
Csaba Repasi 768a209544 Implement 'hasOwn' routine of Object object (#4835)
JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2021-12-15 11:38:02 +01:00
Robert Fancsik ce5c8492b8 Fix arguments object detection in non-complex param list (#4867)
This patch is the followup of #4849.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-15 11:35:27 +01:00
Robert Fancsik dfc001d373 Prevent stack-overflow in json internalize property (#4877)
This patch fixes #4848.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-15 11:34:22 +01:00
Robert Fancsik 070096f30f Fix arrow function this binding resolving if environment record is present (#4878)
This patch fixes #4872 and fixes #4876.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-15 11:32:31 +01:00
Robert Fancsik 7e0aa086ec Adjust fast array growth (#4868)
Since we allow large buffer allocations during array constructor we could extend this behavior to [[Set]] operation as well.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-15 10:35:28 +01:00
Robert Fancsik dbba83fe40 Fix typedarray validation in Atomics read_modify_write (#4879)
This patch fixes #4875.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-15 10:33:21 +01:00
Robert Fancsik d37ff33dbe Fix class constructor as accessor check (#4880)
This patch fixes #4874.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-15 10:32:11 +01:00
Robert Fancsik ee59c226d9 Fix invalid argument reference in Promise.all executor (#4885)
This patch fixes #4871.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-15 10:31:09 +01:00
Robert Fancsik c2eb9ce35c Fix object class check for builtin Atomics (#4889)
This patch fixes #4884.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-15 10:29:29 +01:00
Robert Fancsik bcc711e731 Add stack-overflow check for Array.prototype.{flat, flatMap} (#4899)
This patch fixes #4890

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-15 10:28:18 +01:00
Csaba Repasi 42523bd6e2 Use external string when raising error (#4881)
JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2021-12-10 18:15:00 +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
Robert Fancsik 55acdf2048 Fix buffer overflow in string radix conversion (#4850)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-07 15:28:10 +01:00
Robert Fancsik 18dd9aa75a Prevent arguments object creation if 'arguments' function argument is present (#4849)
This patch fixes #4847.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-07 14:05:48 +01:00
Yonggang Luo f8faf574b6 Rename resource_name to source_name (#4846)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-12-07 14:05:04 +01:00
Robert Fancsik 51da15516e Build fix after #4811 (#4845)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-06 16:46:46 +01:00
Robert Fancsik bfc1121e35 Fix AsyncGeneratorPrototype routines 'this' argument validation (#4811)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-12-06 12:03:26 +01:00
Roland Takacs af297bc578 Separate targets into os and baremetal-sdk parts (#4842)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
2021-12-06 11:02:52 +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
Dániel Bátyai 81d2319144 Improve float number handling and conversion (#4820)
Fixes #4739.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2021-12-03 12:58:37 +01:00
Roland Takacs a1c1d42710 Update Zephyr target to 2.7.0 (#4838)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
2021-12-02 15:33:29 +01:00
Robert Fancsik d69ac0e070 Implement logical assignment operators (#4834)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-11-30 10:44:27 +01:00
Szilagyi Adam 70e275e92f Implement ECMAScript 2022 private class methods and fields (#4831)
Co-authored-by: Robert Fancsik robert.fancsik@h-lab.eu
Co-authored-by: Martin Negyokru mnegyokru@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2021-11-26 12:24:59 +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
batizdaniel fc4168f2b4 Fix numeric literal with leading decimal point in accessor property name (#4832)
JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz daniel.batiz@h-lab.eu
2021-11-24 17:07:57 +01:00
Roland Takacs 3737a28eaf Update NuttX target to releases/10.2 (#4822)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
2021-11-23 13:21:24 +01:00
Roland Takacs 2899582080 Update RIOT target to 2021.10 (#4826)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu
2021-11-23 13:17:46 +01:00
Jacques Germishuys 06b4c02204 Restore esp-idf port (#4828)
This also cleans up all the files, moving them into a single file for
the port itself and module support respectively.

JerryScript-DCO-1.0-Signed-off-by: Jacques Germishuys jacques@beakbooklimited.com
2021-11-23 13:13:50 +01:00
Csaba Osztrogonác a7d5594d30 Fix JERRY_VLA macro on Windows (#4827)
Fixes #4824. The last macro argument should be inside parentheses.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-11-23 13:11:45 +01:00
batizdaniel 6b9e24aa51 Fix function name evaluation order (#4830)
JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz daniel.batiz@h-lab.eu
2021-11-23 11:58:12 +01:00
Robert Sipka 4592143400 Generator declaration is not allowed in single statement position (#4815)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka robert.sipka@h-lab.eu
2021-11-09 08:38:09 +01:00
Robert Fancsik 80777799f6 Fix goto labels indentation (#4818)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-11-05 16:58:41 +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
Robert Fancsik bc091e1742 Optimize ecma_op_function_call (#4817)
Remove redundant isCallable checks

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-11-04 17:26:28 +01:00
Robert Sipka 7ea0000ee0 Minor fix in for-of statement parsing (#4814)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka robert.sipka@h-lab.eu
2021-11-02 19:12:30 +01:00
Zsolt Borbély 6a995e2887 Fix typos in the documentation and related files (#4809)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2021-11-02 11:37:05 +01:00
Zoltan Herczeg 89e367bbfd Optimize typed array access (#4806)
Use uint32 indexes instead of double indexes.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-11-02 11:07:56 +01:00
Zoltan Herczeg 960b99766c Allocate buffers when the buffer pointer is requested (#4812)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-11-02 09:36:55 +01:00
Robert Fancsik 3ad76f932c Fix for-in collection cleanup on abrupt 'has' result (#4807)
This patch fixes #4747

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-11-02 08:40:07 +01:00
Robert Fancsik efe63a5bbc Fix parsing unterminated let statement (#4808)
This patch fixes #4754

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-11-02 08:36:16 +01:00
Robert Sipka 9ed695f9d2 Assignment Expression is not allowed in for of head's expression position (#4810)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka robert.sipka@h-lab.eu
2021-10-29 09:52:30 +02: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
Zoltan Herczeg a024eb2118 Add allocate/free callbacks to ArrayBuffers (#4801)
Larger buffer allocations will throw error instead of calling jerry_fatal.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-10-28 13:51:34 +02:00
Robert Fancsik d2388e907f Implement CreateAsyncFromSyncIterator (#4802)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-10-28 12:45:47 +02:00
Csaba Osztrogonác dd77ec914a Fine-tune test262-esnext jobs on the CI (#4566)
Previously test262-esnext was separated to 2 jobs: language and other tests.
But now tests run in parallel and CI runs release and debug tests too,
separating jobs to release and debug mode is much more obvious. But
debug tests are still slow (~10-11 minutes), let's split only debug job.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-10-27 13:07:58 +02:00
Robert Fancsik 24c1a93d91 Remove block result (#4799)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-10-27 10:59:00 +02:00
Robert Sipka c6f9ea65ce Declaration in the head of a for-of loop can't have an initializer (#4804)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka robert.sipka@h-lab.eu

Co-authored-by: Robert Sipka <robert.sipka@h-lab.eu>
2021-10-27 09:51:14 +02:00
Péter Gál 499cdea75c Fix jerry_value_is_{true,false} documentation (#4803)
The API doc for jerry_value_is_{true,false} incorrectly stated
that it is a replacment for the `jerry_value_is_boolean` method.
The `jerry_value_is_true` is the direct replacement of the
`jerry_get_boolean_value` method and the "false" version is a new
method.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-10-26 09:43:51 +02:00
Csaba Osztrogonác 100b6f577e Test262 exludelist fix after #4721 (#4800)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-10-26 06:45:19 +02:00
ChrisPei 2a4fb19157 Add missing "jerryscript.h" include to esp-idf target (#4759)
JerryScript-DCO-1.0-Signed-off-by: ChrisPei spoppig5@gmail.com
2021-10-21 12:15:44 +02:00
Gergo Csizi 74f98ec4d7 Add Atomics support (#4721)
Creating atomics interface

JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-10-20 15:50:12 +02:00
Gergo Csizi c446871214 Optimize lit_is_valid_utf8_string (#4762)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-10-20 15:45:47 +02:00
Péter Gál 4e8d6344a8 Force value conversion in case of TypedArray filter method (#4794)
During the execution of the TypedArray filter method it is possible
to have a different sized output TypedArray than the input one.
When copying the data to the output array the values must be
correctly converted to the output TypedArray's value range.

Fixes: #4793

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-10-20 15:40:52 +02:00
Péter Gál dae234f416 Correctly convert data in case of TypedArray slice (#4796)
When executin the TypedArray's slice method it is possible to have
the a different element sized output TypedArray. In such case
the data must be converted to the desired element type/size.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-10-20 15:40:33 +02:00
Péter Gál 4912e3b739 Avoid buffer-overflow in Array.slice when using fast arrays (#4797)
In the Array.slice method when the engine uses fast arrays the "end" value
was not updated if the input array's length changed. This can occur when the start/end
index normalization executes a method and the length is changed forcefully.
This leads to a buffer-overflow as the element copy reads too much data from the input
array.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-10-20 15:40:19 +02:00
Zoltan Herczeg b52c114423 Implement eval check for ECMAScript code (#4788)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-10-15 22:25:20 +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 d4231e7251 Split main promise event filter into multiple filters (#4792)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-10-11 12:48:50 +02:00
Mate Dabis f6eac3afdc Add notes to jerry_create_undefined, jerry_create_null and jerry_create_boolean (#4790)
JerryScript-DCO-1.0-Signed-off-by: Mate Dabis mdabis@inf.u-szeged.hu
2021-10-11 11:07:55 +02:00
Zoltan Herczeg c696bc9327 Implement vm throw capture status management for API errors (#4783)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-10-07 11:35:49 +02:00
Zoltan Herczeg 7c21fb89b2 Reorder list of function built-in properties (#4791)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-10-07 09:52:07 +02:00
Zoltan Herczeg d98ff6fd30 Support getting script object in the backtrace callback. (#4789)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-10-06 11:09:01 +02:00
Csaba Osztrogonác 54b1a3c739 Date.prototype.setTime should invalidate local TZA cache (#4786)
Fixes #4749.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-10-01 12:59:38 +02:00
Csaba Osztrogonác f3cd586094 Fix leaking lastIndex values in RegExp built-ins (#4787)
Fixes #4781. This is a followup fix after #4166.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-10-01 12:56:53 +02:00
Zoltan Herczeg 7d355b0f8e Change error message description (#4785)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-10-01 12:24:20 +02:00
Zoltan Herczeg 2a82da62ad Implement source info retrieval API function (#4780)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-29 12:34:38 +02:00
Zoltan Herczeg 8b3eb93167 Add property key filters for general object property enumeration (#4778)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-28 11:01:15 +02:00
Zoltan Herczeg 14ff5bfb52 Add property key filters for built-in functions (#4776)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-23 14:21:47 +02:00
Zoltan Herczeg 35058cde31 Fix incorrect line info computation (#4775)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-22 12:35:24 +02:00
Zoltan Herczeg ca185acded Implement built-in flag support for arguments (#4774)
Duplicate check can be removed from property enumeration.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-22 11:33:13 +02:00
Zoltan Herczeg 053bfa0f9f Support resource name and user value for implicit class constructors (#4771)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-17 16:28:10 +02:00
Zoltan Herczeg 430289b27d Fix built-in types (#4772)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-17 08:18:28 +02:00
Zoltan Herczeg 77c2602205 Implement import.meta object (#4766)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-15 17:44:16 +02:00
Zoltan Herczeg 386ec44d4d Double the maximum number of object references (#4768)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-15 11:08:57 +02:00
Zoltan Herczeg d08b5be57f Remove built-in flag from object type (#4763)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-13 19:25:22 +02:00
Zoltan Herczeg 723b26392d Fix property enumeration order of built-in properties (#4761)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-13 15:32:14 +02:00
Zoltan Herczeg 2c2539c6b8 Throw SyntaxError when module resolving is failed (#4765)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-09 22:11:42 +02:00
Zoltan Herczeg fea10bb7e3 Add name to the function property names (#4760)
Furthermore prototype should be the first property.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-03 12:42:06 +02:00
Zoltan Herczeg 1523ca3b26 Fix prototype of the values returned by Promise.allSettled (#4758)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-03 12:15:06 +02:00
Zoltan Herczeg e1ce7dd727 Fix invalid typed array construction (#4757)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-02 12:13:00 +02:00
Zoltan Herczeg f94a3c80bd Fix line info computation (#4756)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-09-01 18:39:38 +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
Péter Gál 1c6b18ecdf Add missing info in API doc (#4733)
As a few methods were removed and replaced it is a good idea to describe
which method(s) can reproduce the same functionality. In addition add a
bit of extra comments for various methods/structs.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-08-30 17:27:37 +02:00
batizdaniel bf049fbe2d Remove redundant checks from builtin-dispatchers (#4741)
We don't need to check arguments length inside the custom dispatchers,
because we have already checked within ecma_bultin_dispatch_routine.

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz batizjob@gmail.com
2021-08-30 14:13:31 +02:00
Zoltan Herczeg 8cbe1b59c1 Implement getter function for external string user pointer (#4742)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-08-30 14:04:13 +02:00
Péter Gál 4175037fb0 Disable IRC notification action to have a green master (#4753)
IRC notification GitHub action returns an error at the moment
and makes the master red (even if all builds passed).

Disable this action till we fix the notification.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-08-30 13:27:30 +02:00
Gergo Csizi b4fc591398 Add new test for resource_name (#4737)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-08-30 10:04:14 +02:00
Gergo Csizi 5a69b183c3 Rename jerry_string_set_external_string_free_callback (#4743)
jerry_string_set_external_string_free_callback -> jerry_string_set_external_free_callback

JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-08-27 20:02:32 +02:00
Paul Sokolovsky be910b9867 targets: zephyr: Update for Zephyr 2.x (#4731)
targets: zephyr: Update for Zephyr 2.2

Zephyr 2.2 removed some deprecated compatibility headers, use the new
location.

targets: zephyr: Update for Zephyr 2.3

Rename CONFIG_FLOAT -> CONFIG_FPU based on the change done in Zephyr 2.3.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org

targets: zephyr: Update CI and docs for Zephyr 2.6

And to the latest Zephyr SDK 0.13.0. arduino_101 board is no longer
supported by Zephyr 2.x, so replace it with qemu_x86 (i.e. QEMU
emulation target) in CI and with frdm_k64f in docs.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2021-08-26 14:55:30 +02:00
batizdaniel 3bcd48f72d Improve parse_identifier (#4691)
Ascii string length is no longer computed during string allocation.

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz batizjob@gmail.com
2021-08-17 12:16:58 +02:00
Zoltan Herczeg e7ffb70ae0 Rework external string free operation (#4690)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-08-17 08:31:30 +02:00
Zoltan Herczeg 74e5ccd434 Improve storing the line info data during parsing (#4735)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-08-17 08:29:30 +02:00
Gergo Csizi fc29019165 Simplify jerry_get_resource_name (#4730)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-08-12 17:21:37 +02:00
Zoltan Herczeg 3ed93cfb51 Support parsing of scripts / functions stored in string values (#4728)
Function arguments must be passed as string values.
Snapshots are generated from compiled code rather than source code.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-08-11 17:37:12 +02:00
Gergo Csizi b7dead7b05 Add guards for SharedArrayBuffer (#4723)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-08-10 17:21:06 +02:00
batizdaniel a25b824509 Implement {Array, %TypedArray%, String}.prototype.at method (#4681)
The following methods were implemented:
- Array.prototype.at based on ECMA-262 Stage 3 Draft Relative Indexing Method proposal
- String.prototype.at based on ECMA-262 Stage 3 Draft Relative Indexing Method proposal
- TypedArray.prototype.at based on ECMA-262 Stage 3 Draft Relative Indexing Method proposal

https://tc39.es/proposal-relative-indexing-method/

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz batizjob@gmail.com
2021-08-10 17:19: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
Virag Orkenyi b6ec9275aa Add custom dispatcher to error-prototype (#4692)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-08-03 11:09:33 +02:00
Zoltan Herczeg c438d5fa92 Support string iterator for strings longer than 64K (#4727)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-08-03 10:44:19 +02:00
Tóth Béla f71a4a6975 Merge Promise Guard with ESNEXT (#4725)
JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-08-02 17:35:32 +02:00
Zoltan Herczeg 951044c036 Change resource name to a string. (#4724)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-27 13:40:19 +02:00
Tóth Béla d99905aca6 Implement container operators API function (#4697)
Basically re-opening and updating #4275

Co-authored-by: bence gabor kis <kisbg@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu

Co-authored-by: bence gabor kis <kisbg@inf.u-szeged.hu>
2021-07-27 12:25:52 +02:00
Zoltan Herczeg d69fe41085 Improve garbage collection of scripts and modules (#4722)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-26 14:03:43 +02:00
Zoltan Herczeg d4178ae386 Support dynamic import calls (#4652)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-24 09:26:46 +02:00
Gergo Csizi d9360f51d0 Add SharedArrayBuffer support (#4689)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-07-23 17:29:06 +02:00
Virag Orkenyi bbf1c0105b Add custom dispatcher to builtin-json. (#4679)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-07-20 11:32:20 +02:00
Virag Orkenyi b25b640ff5 Add custom dispatcher to array-iterator-prototype (#4693)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-07-20 11:31:25 +02:00
Virag Orkenyi 298228abdd Add custom dispatcher to map-iterator-prototype (#4694)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-07-20 11:30:55 +02:00
Virag Orkenyi 57a09cbc9d Add custom dispatcher to async-iterator-prototype (#4714)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-07-20 11:30:13 +02:00
Virag Orkenyi d65d035a36 Add custom dispatcher to builtin-string-iterator-prototype (#4715)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-07-20 11:29:38 +02:00
Virag Orkenyi 6296a8251c Add custom dispatcher to builtin-iterator-prototype (#4716)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-07-20 11:29:10 +02:00
Virag Orkenyi 7de391931a Add custom dispatcher to set-iterator-prototype (#4717)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-07-20 11:28:30 +02:00
Zoltan Herczeg 713d90b5a0 Support shared user data for scripts (#4710)
The same data is returned for the script and all of its functions,
including those which are created by an eval call.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-20 10:33:23 +02:00
Zoltan Herczeg 9ff25dbc12 Replace jerry_load_function_snapshot function with a flag (#4719)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-16 16:09:51 +02:00
Zoltan Herczeg 252d68936f Improve line info construction (#4718)
- Simplify small encoding
- Better line info for some corner cases

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-16 16:08:38 +02:00
Péter Gál d5a7839632 Improve Proxy recrusion check in their internal methods. (#4568)
In some parts of Proxy internal methods the compiler can do a bit of
tail call optimalization which would be ok, but the current stack limit
check framework in Jerry uses the stack pointer to calculate the stack depth.
This way of stack depth calculation is affected by the tail call optimalization
(as the stack does not increase).

By disabling the tail call optimalization at given points the stack limit calculation
will work as expected. This causes a bit of stack overhead, but the Proxy in it self
is a fairly big chunk of code and this stack limit would only be relevant if the Proxy
already does recusion which already very edge case.

The stack limit (--stack-limit=..) should be enabled to correctly report such stack
depth errors.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-07-15 14:02:53 +02:00
Zoltan Herczeg 998e49a969 Rework storing the line/column/bytecode info (#4707)
This information is stored in a separate memory block instead
of being part of the byte code. Snapshot does not supported.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-15 13:45:10 +02:00
Zoltan Herczeg 4be05a74eb Remove ecma_parse_options_t in favor of jerry_parse_options_t (#4713)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-15 13:44:52 +02:00
Tóth Béla 305741a608 Merge Map and Set Guards with Container (#4709)
Remove JERRY_BUILTIN_MAP/SET/WEAKMAP/WEAKSET
and replace them with JERRY_BUILTIN_CONTAINER.

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-07-12 11:20:38 +02:00
Zoltan Herczeg 7f6a699700 Implement namespace exports in modules (#4708)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-09 07:23:28 +02:00
Jiawen Geng e3a299b3d6 Add clang build to CI (#4706)
A follow up to https://github.com/jerryscript-project/jerryscript/pull/4684

JerryScript-DCO-1.0-Signed-off-by: Jiawen Geng technicalcute@gmail.com
2021-07-06 17:58:19 +02:00
Zoltan Herczeg d1204ab1c9 Rework resolving references and namespace creation in modules (#4695)
- Properties of namespace objects are ordered in lexical order
- The namespace object is created and imports are bound during linking phase
- Namespace imports are changed to read-only
- Reduced memory consumption

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-07-06 14:50:19 +02:00
Tóth Béla ccc152594a Fix failing container unit-test (#4696)
JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-06-28 15:46:03 +02:00
Virag Orkenyi 811fd4c054 Add custom dispatcher to builtin_string (#4661)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-06-24 15:40:48 +02:00
Gergo Csizi 8f71871a39 Remove jerry_get_boolean_value (#4685)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-06-24 15:40:14 +02:00
batizdaniel 6de17b204e Fix implicit conversion error (#4684)
This patch fixes the #4682

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz batizjob@gmail.com
2021-06-24 15:38:56 +02:00
Virag Orkenyi d97d407eee Add custom dispatcher to builtin_weakref_prototype. (#4686)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-06-24 15:36:47 +02:00
Virag Orkenyi dddd37d38f Add custom dispatcher to builtin-proxy (#4687)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-06-24 15:36:25 +02:00
Tóth Béla 9471515dae Add container related API function (#4666)
The new function returns with an array, containing the
elements of the given Container or Container iterator.

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-06-16 07:41:13 +02:00
Zoltan Herczeg 5729dd8cec Object.assign should copy undefined values (#4688)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-06-10 10:59:54 +02:00
Gergo Csizi e8ed543677 Add test_dataview (#4677)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-05-31 14:24:38 +02:00
csdkamikaze 703ddae194 Typo fix in 02.API-REFERENCE.md (#4680)
JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz batizjob@gmail.com

Co-authored-by: Daniel Batiz <batizjob@gmail.com>
2021-05-26 14:37:22 +02:00
Gergo Csizi ce5e4d49b1 Fix documentation and add back some tests (#4673)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-05-26 12:28:32 +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
Gergo Csizi 800031c62b Change jerry_get_own_property_descriptor return type (#4675)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-05-26 06:54:26 +02:00
Zoltan Herczeg 431a28b902 Fix native error check (#4674)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-05-21 12:36:07 +02:00
Zoltan Herczeg 3c512d937b Add getter for Proxy handler objects (#4676)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-05-21 12:35:53 +02:00
Zoltan Herczeg 67a61bc211 Support this binding retrieval for backtrace frames (#4669)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-05-17 11:41:29 +02:00
Philippe Coval a67f198134 build: Support cmake -DPYTHON=python3 (#4667)
This will help debian packaging of iotjs

JerryScript-DCO-1.0-Signed-off-by: Philippe Coval rzr@users.sf.net
2021-05-17 11:37:09 +02:00
Zoltan Herczeg 5180680030 Support line info for class fields (#4670)
Furthermore fix function info for call frames.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-05-17 11:15:02 +02:00
Zoltan Herczeg 26f604ce1e Change error message format of DefineProperty (#4672)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-05-17 11:14:38 +02:00
Zoltan Herczeg e042998f02 Support function object retrieval for async functions (#4668)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-05-11 12:22:37 +02:00
kisbg a58884c169 Update TypedArray internals methods (#4653)
releated test262 test-cases has been removed from the skip list.

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-04-27 09:45:26 +02:00
Zoltan Herczeg 823a8b128d Fix error throw in jerry_define_own_property (#4662)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-27 09:42:20 +02:00
Zoltan Herczeg 8aaabd8b01 Do not mark the unused items of a WeakMap (#4663)
The new method is slower, but correctly release unused objects.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-27 09:42:03 +02:00
kisbg ce24edae24 Add check Proxy object [[SetPrototypeOf]] (#4631)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-04-26 09:21:29 +02:00
Zoltan Herczeg b4bea25f13 Export assignment expression must not track variables (#4660)
Only export the result of the assignment expression. This value cannot be changed later.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-21 08:56:50 +02:00
Zoltan Herczeg dead11cdd0 Fix external pointer allocation issues. (#4658)
The allocations during the update of external pointers may trigger
the GC. Due to a new feature, the GC uses the external pointer data
to mark objects, which caused crashes in some cases.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-20 11:53:58 +02:00
Zoltan Herczeg 10002aef60 Throw ReferenceError when a property of a native module is not found (#4659)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-20 11:04:26 +02:00
Zoltan Herczeg 4f15332e95 Export default in namespace object (#4657)
Fix a crash when the exported value is a reference.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-19 18:31:59 +02:00
Zoltan Herczeg ec3ed65b56 Add reference support for native pointers. (#4615)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-19 14:47:17 +02:00
Tóth Béla cc1a263657 Continue replacing duplicate ecma definitions (#4644)
JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-04-19 13:44:01 +02:00
Zoltan Herczeg 1f2a8d4ac1 Add notification callback for module state changes (#4656)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-16 17:50:57 +02:00
Zoltan Herczeg a7a4cb29e4 Native modules should be unlinked state after creation (#4655)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-16 15:55:12 +02:00
Zoltan Herczeg 7b6743403f Support native modules (#4649)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-13 16:26:38 +02:00
Zoltan Herczeg 05a4e45ece Fix uninitialized data in create native property (#4650)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-13 15:17:25 +02:00
kisbg 60cbc93cd7 Update TypedArray Builtin function (#4633)
Also create TypedArray object with object method has been added.

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-04-13 13:37:04 +02:00
Zoltan Herczeg 053389de80 Add info to external pointer free callback. (#4642)
Furthermore reduce memory consumption when only
one external pointer is assigned to an object.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-13 09:51:39 +02:00
Zoltan Herczeg b3ec217b50 Create namespace with references for modules (#4646)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-12 15:58:56 +02:00
Zoltan Herczeg ef35c0329c Remove class id storing for class objects (#4645)
The two bytes which stored the id is free to use. Currently the only exception is containers.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-08 14:46:16 +02:00
kisbg 2381078e80 Add constant error messages (#4640)
added two new file ecma-errors.h and ecma-erros.c

it contains the most used errors messages.

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-04-07 12:46:12 +02:00
Zoltan Herczeg d85020f709 Remove pseudo array object type from the project (#4643)
A new class type enum is introduced to describe the class of objects.
This enum is organized to improve property resolve and GC performance.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-04-06 18:46:48 +02:00
Zoltan Herczeg 4377ef684d Add module C API functions (#4636)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-03-31 19:40:58 +02:00
Tóth Béla 6677fa0a12 Replace duplicate ecma definitions (#4637)
JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-03-31 11:52:33 +02:00
Zoltan Herczeg 6c484f3529 Rework module linking (#4632)
The module linking process from jerry_parse is moved out into
a new jerry_module_link function, and jerry_parse is limited to
create unlinked modules.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-03-30 15:40:09 +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
kisbg 22ebb00a4c Implement Promise.any and AggregateError Object (#4623)
JerryScript-DCO-1.0-Signed-off-by: Bence Gabor Kis kisbg@inf.u-szeged.hu
2021-03-22 12:42:20 +01:00
Zoltan Herczeg edd2f20397 Remove jerry_port_track_promise_rejection (#4613)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-03-11 19:58:44 +01:00
Zoltan Herczeg e739f11ed2 Return early when checking logical operators (#4626)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-03-11 19:35:39 +01:00
kisbg 8321640c4e Remove unnecessary ecma_deref_ecma_string in regExpStringIterator (#4625)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-03-11 09:14:45 +01:00
Zoltan Herczeg 546422161e Add custom configuration to jerry_parse and its variants (#4620)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-03-10 09:56:48 +01:00
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 dc3ae4ff06 Implement Promise.allsettled (#4616)
Also i updated the promise race and all method to the latest standart

The two jerry/es.next test-cases has been update to support the latest standart

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-03-08 11:43:42 +01:00
Peter Marki 96cd542bf5 Refactor jerry_property_descriptor_t to use status flags (#4594)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2021-03-08 09:08:24 +01:00
kisbg 9254cd4e7a Add ThrowTypeError name property (#4618)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-03-05 10:40:17 +01:00
Zoltan Herczeg 29b7c8f8ff Implement jerry_get_own_property API function (#4612)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-03-03 18:02:40 +01:00
Zoltan Herczeg a95e3e37e1 Add more skip check options for Proxy objects (#4614)
Reorganize the flags to follow the list in ES2020 section 9.5

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-03-03 17:12:36 +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
Péter Gál 9556701742 Add size checks before using JERRY_VLA in unittests (#4601)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-02-26 10:53:54 +01:00
Zoltan Herczeg 17ed855df5 Default handlers should count as resolvers (#4611)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-25 12:27:21 +01:00
Zoltan Herczeg c27047da03 Add filters and more events to Promise callback. (#4605)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-24 10:31:08 +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
Péter Gál 1623c8db1e Limit the string size in jerry_port_track_promise_rejection (#4603)
The maximum Promise reject reason string is now limited to a 5 kib string.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-02-24 09:14:14 +01:00
Zoltan Herczeg a3bdd36556 Reduce memory consumption of Promise objects (#4607)
No need to keep a reference to resolver functions.
Unused resolvers are cleaned up sooner by GC.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-24 08:51:23 +01:00
Zoltan Herczeg 1cf2989a64 Add new.target argument to Promise create (#4606)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-24 08:50:05 +01:00
Zoltan Herczeg 5c35370327 Create special objects for scripts instead of functions (#4610)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-23 15:34:09 +01:00
Robert Fancsik 322265bfb9 Move push literal number opcodes to basic opcodes (#4609)
`obj[number]` is a widely used structure especially for array element indexing, however super property assignment is not.
This patch moves super-assignment opcodes to ext opcodes and fills the freed 3 basic opcodes with push-literal-number ones.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-02-23 10:00:00 +01:00
Dániel Bátyai 2240a9153a Optimize the copying/freeing of ecma values (#4602)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2021-02-22 08:32:10 +01:00
Dániel Bátyai 242c3a55e3 Always run all checks regardless of the previous job result (#4604)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2021-02-18 19:40:21 +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
Robert Fancsik c14702c129 Keep GNU fastpath for jerry_port_get_local_time_zone_adjustment (#4600)
PR #4513 caused a measurable slowdown by removing the GNU specific TZA calculation.
This patch reverts this removal but also keeps the general implementation introduced in #4513

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-02-17 20:44:00 +01:00
Zoltan Herczeg 112ad83aaa Rework external function handlers (#4599)
Instead of a fixed number of arguments, a call info structure is passed
to the handlers, which can be extended in the future without breaknig the
API. This structure holds new.target value, so its getter function is removed.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-17 17:52:19 +01:00
Robert Fancsik 488a0bf7e8 Improve date internals (#4593)
- Optimize year from time calculation
- Force arithmetic operations to int32_t/int64_t whenever possible
- Optimize number conversion in date parse
- Cache local TZA of the date object
- Fix a bug in Date.parse timezone parsing

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-02-17 16:07:54 +01:00
Virag Orkenyi 67e7e89c8e Implement BigInt.prototype.toLocaleString (#4355)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-02-17 14:20:44 +01:00
Yonggang Luo 3afb007123 Optimize bit operation in vm.c (#4591)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-16 13:17:21 +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
Péter Gál a95a0b3539 Use C99 flexible array member notation in parser memory struct (#4592)
The usage of a single byte sized array as a flexible array member can lead to
compiler/analyzer errors or warnings. Not specifying the size in the array is
correct as per C99 standard.

Flexible array members are defined in the C Standard, 6.7.2.1 (ISO/IEC 9899:1999).

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-02-11 14:18:35 +01:00
Peter Marki a9c83020df Fix failing Date tests in test262-esnext (#4561)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2021-02-11 14:01:58 +01:00
Yonggang Luo 34a6a93597 Fix indent in documentation of cmake options (#4588)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-10 10:45:29 +01:00
Yonggang Luo 2a6917b5a5 Fix documentation of cmake options (#4587)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-10 01:31:27 +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
Yonggang Luo 818cc8ddab Split globalThis to be configurable. (#4575)
JERRY_BUILTIN_GLOBAL_THIS can be enabled without JERRY_ESNEXT

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-09 16:20:05 +01:00
Yonggang Luo f7c817efcf Take care of year before 1601 on win32. (#4580)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-09 15:23:28 +01:00
Zoltan Herczeg ec872818c2 Add implementation specific date parsing (#4576)
It is compatible with Firefox and Chrome.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-09 15:03:06 +01:00
Zoltan Herczeg 53aed02762 Fix null getters/setters in jerry_property_descriptor_from_ecma (#4573)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-09 15:01:50 +01:00
Zoltan Herczeg 6fd0dfec35 Fix template memory leak when debugger is running (#4572)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-09 14:59:45 +01:00
Yonggang Luo c2e016ec06 Add space between JERRY_ATTR_PURE and type (#4583)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-09 09:45:08 +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
Tóth Béla 35ecf4c4a3 Fix "Invalid prefix operation" errors (#4577)
`--(-a);` returned with a postfix error before this patch.
The changes introduce a new warning for prefix errors, and
returns with the corresponding one based on current opcode.

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-02-08 16:13:37 +01:00
Zoltan Herczeg b1f73e698a Fix deleting native pointers (#4570)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-05 19:35:30 +01:00
Péter Gál ca6c2194bb Fix incorrect assert expression in lexer_check_property_modifier (#4569)
In the lexer_check_property_modifier the assert incorrectly does
an assignment instead of a simple equals check.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-02-05 11:24:29 +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
Zoltan Herczeg 3623ac789d Introduce generic backtrace capturing (#4555)
Remove jerry_get_backtrace_from function

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-04 16:33:59 +01:00
Robert Fancsik feb2855f0c Fix cleanup in VM_OC_INITIALIZER_PUSH_PROP on abrupt completion (#4564)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-02-04 16:05:56 +01:00
Zoltan Herczeg 9ca046b670 Add non-standard behaviour support for Proxies (#4562)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-04 15:58:16 +01:00
kisbg e9df2ca814 Add newtarget support AsyncFunction (#4560)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-02-04 14:30:11 +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 9db4ec7d77 Disable conversion warning on win32/gnu-mingw (#4516)
It's a mingw-runtime issue, but we disable conversion warning on win32/gnu-mingw
for getting jerryscript compile with mingw first.
The bug url are: https://sourceforge.net/p/mingw-w64/bugs/874/

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-04 13:23:45 +01:00
Yonggang Luo aa941ed58e Fixes math library compiling on msvc (#4511)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-04 13:19:13 +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
Yonggang Luo 982cd08083 Rename unix to jerry for entrance files. (#4536)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-04 13:13:57 +01:00
Robert Fancsik e7d11eaf9e Improve destructuring patterns (#4527)
- Fix evaluation order of the operands
- Implement proper iterator closing of array destructuring
- Support next method caching

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-02-04 13:11:11 +01:00
Robert Fancsik 3bb67397a0 Fix lexical declaration check for let variables (#4529)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-02-04 13:07:38 +01:00
Robert Fancsik a1b682a83d Fix literal index decoding for CBC_MOV_IDENT (#4539)
This patch fixes #4532.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-02-04 13:01:14 +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
Péter Gál d7843be2e8 Add unittest to check realm object and realm this types (#4548)
Make sure that realm object and realm this types are tested.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-02-04 11:19:05 +01:00
Péter Gál dd0b00fdad Add missing tests for realm object type via jerry_object_get_type (#4552)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-02-04 10:39:05 +01:00
Robert Fancsik c82f184f00 Ensure that fast arrays length property is always writable (#4559)
Also remove legacy `ecma_array_object_set_length_flags_t`.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-02-03 19:12:15 +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
Peter Marki 090b6307a6 Fix failing AsyncFunction tests in test262-esnext (#4545)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2021-02-02 12:35:58 +01:00
kisbg 748e1be041 Minor fix in create ArrayBuffer object (#4556)
JerryScript-DCO-1.0-Signed-off-by: Bence Gabor Kis kisbg@inf.u-szeged.hu
2021-02-01 16:49:12 +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
Péter Gál 62dc782e5c Extend jerry_create_realm API docs a bit (#4549)
Add additional information for jerry_create_realm method and rework the
example to be a compilable/runnable doctest.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-29 13:15:37 +01:00
Akos Kiss 87d30b8088 Refactoring time-related default port implementations (#4513)
In the non-Windows code paths:
- New approach to compute TZA without the need for GNU-specific
  `struct tm.tm_gmtoff`.
- Always using `usleep` to sleep. (No real need for `nanosleep` as
  port API has sleep granularity of milliseconds.)
- Not checking for "time.h" at build configuration time as that
  header is mandated by the C standard.
- Not checking for "unistd.h" at build configuration time as that
  header is mandated by the POSIX standard (the default port is
  targeting POSIX systems -- and Windows).
- Fixing some macro guards.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-29 10:45:46 +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
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
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
kisbg ff1a99b999 Date.prototype.setTime should return with clipped date (#4520)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-01-26 11:00:45 +01:00
Péter Gál 0e21c17080 Add missing version info to API docs (#4541)
A few new methods did not have the version info to describe
in which version were they introduced.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-25 15:59:00 +01:00
Virag Orkenyi b8a0ffd913 Fix the number_tobigint conversion problem (#4519)
JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
2021-01-25 11:54:55 +01:00
Yonggang Luo 8be6aec50d Fix Clang compilation error when comparing double with int64_t (#4531)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-23 13:38:22 +01:00
Yonggang Luo 1db0905889 Fix MinGW compilation errors in jerry-ext (#4510)
MinGW also needs linking to ws2_32.
Defining socket types for unix/win32 for compatibility.
Also fixes #4512

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-22 17:54:36 +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
Péter Gál 8ba0d1b6ee Update profile README file (#4523)
Add previously missed new defines to the documentation and update the
defines to be in lexicographical order.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-22 10:27:57 +01:00
Zoltan Herczeg d646cf51ee Set the correct realm when global code is running (#4522)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-22 09:17:38 +01:00
Robert Fancsik bf7fa39581 Rework export default parsing (#4505)
- Remove SCANNER_LITERAL_POOL_DEFAULT_CLASS_NAME workaround
- Add async and generator function support
- Fix auto semicolon insertion after export statement
- fixes #4150.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-19 16:30:41 +01:00
Robert Fancsik 3e548401fd Invalid regexp literals should throw syntax error in ES11 (#4506)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-19 16:20:23 +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
Yonggang Luo cb85797ab5 Fix comment in log1p.c (#4507)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-18 21:26:21 +01:00
Dániel Bátyai 8e83638daa Update the name handling of anonymous functions to ES11 (#4279)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2021-01-18 18:20:24 +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
Akos Kiss 1d42d17ab6 Make all dynamic memory allocations via core API functions in jerry-ext (#4480)
Direct calls to `malloc` and `free` should be avoided,
`jerry_heap_alloc` and `jerry_heap_free` should be used in their
place. Build-time configuration should decide whether those calls
manage dynamic memory on the engine's heap or on the system heap.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-18 18:07:07 +01:00
Péter Gál b313824228 Update API docs for 2.4 release (#4504)
Replace the [[NEXT_VERSION]] entries with the exact version number
in the API reference documentation.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-18 18:01:10 +01:00
Robert Fancsik 2ade072e53 Optimize lexenv binding creation (#4502)
- Declarative environment no longer need to lookup the created binding for setting it's value
- Unfold vm_decl_var and vm_set_var into vm_loop to reduce error checks
- Reduce code duplication in ecma_module_connect_imports
- Fix deleted binding setting in `ecma_op_set_mutable_binding` (fixes #4468)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-18 17:38:54 +01:00
Zoltan Herczeg 3b77117a2e Add a callback which is called when Error objects are created (#4465)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-18 16:56:38 +01:00
Robert Fancsik e00964176d compile_commands.json should be generated for the whole project (#4503)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-18 16:15:40 +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
Robert Fancsik c4676a21fe Introduce jerry_port_track_promise_rejection (#4451)
This patch resolves #2931.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-18 14:59:42 +01:00
Robert Fancsik 79a2392b79 Remove template array flag from arrays after the collection is freed (#4500)
This patch fixes #4469.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-18 12:10:49 +01:00
Yonggang Luo 90d206dcee Fix free of NULL value in function ecma_typedarray_helper_dispatch_construct (#4473)
Currently, ecma_op_get_prototype_from_constructor may return NULL
and the function didn't raise that exception.
Also optimize multiple assignment of prototype_obj_p and
multiple access of JERRY_CONTEXT (current_new_target) out.

This fixes https://github.com/jerryscript-project/jerryscript/issues/4463

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-18 10:35:47 +01:00
Yonggang Luo f894a8fad5 Fixes module-resource-name.js on win32. (#4481)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-18 10:32:48 +01:00
Yonggang Luo ccf511a544 new_target_object -> new_target_object_p (#4498)
Depends on https://github.com/jerryscript-project/jerryscript/pull/4478

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-18 10:25:14 +01:00
Yonggang Luo 69ce755593 Add ${PYTHON_EXECUTABLE} for "Generating doctests" (#4496)
On win32, the ${PYTHON_EXECUTABLE} should be specified, otherwise the python script
can not be executed properly.

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-17 20:39:21 +01:00
Akos Kiss 9bc0f2fd3f Unify asserts in jerry-ext (#4488)
Some components of the jerry-ext library re-declared their own
assert and/or static assert macros. No need to re-invent the wheel
all the time. This patch makes all components use the assert macros
defined in jext-common.h. This also makes maintenance easier.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-17 15:21:46 +01:00
Yonggang Luo 11894a6032 current_new_target -> current_new_target_p (#4478)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-17 14:53: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 1fe7c3531a Sort source and header lists in cmake files (#4487)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-16 21:39:18 +01:00
Yonggang Luo abaf9637d7 Use approxEq to judge double compare in math-cbrt.js (#4483)
Number.EPSILON used as maximal differences.

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-16 21:25:41 +01:00
Yonggang Luo 3ce4dce805 Use _WIN32 instead WIN32. (#4484)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-16 21:22:28 +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
Yonggang Luo fd0ca7da69 exclude test-ext-autorelease.c in SOURCE_UNIT_TEST_EXT_MODULES properly (#4485)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-16 16:33:48 +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
Péter Gál abedab5ac2 Fix objects foreach unittest in case of mem-stress-test (#4460)
When the mem-stress-test is enabled for the objects foreach unittest
the object counting is off by one. This was due to incorrect assumption
on when the gc is triggered.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-15 20:50:26 +01:00
Robert Fancsik ad7fc07ca4 Add missing error check for for-in HasNext check (#4471)
This patch fixes #4464.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-15 20:48:49 +01:00
Péter Gál b0ca537a34 Correctly release values in Proxy.[[Get]] (#4477)
In Proxy.[[Get]] if the target.[[GetOwnPropertyDescriptor]] fails the
trap result should be freed.

Fixes: #4466

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-15 20:48:13 +01:00
Yonggang Luo 9ce7e49073 rename misspell regression tests file name. (#4479)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-15 20:46:57 +01:00
Robert Fancsik aefd381cf1 Rename 'this' to 'this_arg' in function arguments (#4476)
'this' is a restricted keyword in C++ so it's a good practice to avoid it's usage as an identifier.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-15 18:24:25 +01:00
Tóth Béla 91baa17c51 Update TypedArray builtins to latest standard (#4210)
- Introduce `ecma_typedarray_species_create` and `ecma_typedarray_create`
- Update Typedarray's filter method

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2021-01-15 15:21:50 +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
Robert Fancsik 363bc92529 Remove new target workaround from super call (#4447)
After #4372 and #4369 all builtin constructors have new target support.

This patch fixes #4446.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-15 13:28:59 +01:00
Szilagyi Adam df6d430289 Refactor ecma_builtin_global_object_unescape (#4115)
based on ECMA-262 v11, B.2.1.2

Fixed tests from the exclude list:
* annexB/built-ins/unescape/four-ignore-bad-u.js
* annexB/built-ins/unescape/four.js
* annexB/built-ins/unescape/two.js

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2021-01-14 16:16:32 +01:00
Akos Kiss 4541524256 Drop -fno-... compiler flags from CMakeLists (#4457)
- `-fno-builtin` should not be necessary: a) by default, we assume
  that a libc exists on the system the project is compiled for, but
  b) even if the assumption does not hold, `-fno-builtin` can be
  passed as an external CFLAG to the build system, plus c) the use
  of builtins is expected to help both code size and performance.
  (Except when jerry-math is enabled.)
- `-fno-stack-protector` should not be necessary: it is the default
  not to instrument code with stack protection.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-14 10:31:59 +01:00
Péter Gál 75586242ba Fix error instance query if the error is from a Proxy (#4459)
When accessing an error's type there is no need to check the Proxy
prototype (as there is none).

Fixes: #4440

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-13 15:14:04 +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
Csaba Osztrogonác c84afefd47 Fix the build and timezone offset with MinGW (#4449)
Changes:
- Use _WIN32 macro instead of _WINDOWS
- Fix build error - "no previous declaration for 'UnixTimeToFileTime'"
- Fix conversion build errors
- Remove useless _tzset() call
- Use GetSystemTimeAsFileTime() on Windows to get current time
- Unify and simplify time conversion Windows helper functions

Fixes #4240

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-01-13 11:39:16 +01:00
Zoltan Herczeg 3193e6d0dc Implement jerry_get_backtrace_from API function (#4454)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-12 19:52:05 +01:00
Akos Kiss c46f4c3e40 Improve the path normalization of the default port (#4444)
Determine the length of strings as early as possible and use that
to prevent unnecessary memory allocations, and in memory copies
instead of string concatenations.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-12 19:31:20 +01:00
Akos Kiss 053fe4b331 Make the whole GH Actions Notification job conditional (#4443)
Don't even start the job if the workflow event is not a push to the
master repo.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-12 16:36:59 +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 4399744588 Remove file(GLOB ...) usage from CMakeLists.txt (#4427)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-12 10:47:36 +01:00
Robert Fancsik 5cef002ed6 Fix underscore lookahead in hex literal parsing (#4448)
This patch fixes #4442.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-11 18:48:53 +01:00
kisbg 8ddd24f870 Add new target support to Error object and NativeErrors (#4372)
EcmaScript 11 19.5.1.1 Error
EcmaScript 11 19.5.6.1.1 NativeError

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-01-11 15:08:21 +01:00
kisbg 2919a6463f Add new target support for ArrayBuffer and TypedArray (#4369)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-01-11 14:20: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
Robert Fancsik dcf9252892 Fix mapped arguments legacy argument definition initialization (#4434)
This patch fixes #4432.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-11 12:30:52 +01:00
Akos Kiss edb01f63d5 Replace isnan with inequality check to avoid conversion warning in older Clang (#4438)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-11 12:29:00 +01:00
kisbg 4c41f8ee07 Add proxy and bound function support for GetRealm method(#4407)
ecma_op_function_get_function_realm now can process proxy and bound functions.

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-01-11 11:31:27 +01:00
Csaba Osztrogonác daba2b76fc Fix HAVE_M_LIB check for older CMake (#4437)
With older CMake (for example 2.8.12.2) the feature check of HAVE_M_LIB
reports false positive fail due to -Werror=strict-prototypes. It is already
fixed in CMake https://gitlab.kitware.com/cmake/cmake/-/commit/4bc17345

The feature is present and works, so we should only ignore this build warning.

Additionally the necessary GCC/Clang guard added to the similar
CMake feature check in jerry-port/default/CMakeLists.txt

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-01-11 11:26:47 +01:00
Akos Kiss 99ec5b9bab Farewell to Travis CI (#4436)
Travis CI became very slow lately. Most of the jobs have already
been moved to GH Actions. This commit finishes the migration.

- IRC notification is adapted (result of jobs is not reported).
- Sonar integration is dropped without replacement, as its GH
  Action does not support C projects.
- Coverity Scan integration is dropped without replacement as it
  has no GH Action at all.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-10 16:30:58 +01:00
Robert Fancsik b7b2e0360e Move ARM and target checks to Github Actions from Travis (#4430)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-08 20:08:03 +01:00
Robert Fancsik 7b00db4079 Fix unavailable source file handling in main_print_unhandled_exception (#4424)
This patch fixes #4403.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-08 16:03:33 +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
Akos Kiss 29785b2af3 Fix the include directory in the pkgconfig of the math lib (#4414)
The pkgconfig specified `include/jerry-math` as the include
directory, but cmake installs header to `include/jerryscript-math`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-08 16:00:44 +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 f50728ef8d Rework GitHub Actions workflow configuration (#4412)
- Make jobs run on latest versions of the OS's (except for
  "Checks", which relies on specific versions of checkers coming
  with Ubuntu 18.04)
- Bump actions/checkout to v2
- Rewrite `apt-get` to `apt` (almost the same, but `apt` is the
  2nd gen tool)
- Drop step names (they took too much vertical space, didn't add
  too much useful information, and were very typo-prone)
- Move superfluous environment variables (e.g., `BUILD_OPTIONS` or
  `SKIP_LIST`) to their expansion sites (use YAML block scalars
  `>-` where appropriate to enhance readability)
- Fix duplicate installation of pylint in the "Checks" job

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-08 15:59:35 +01:00
Robert Fancsik b56fa43aa3 Fix VM stack size calculation for class initializer assignments (#4426)
This patch fixes #4413.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-08 14:08:55 +01:00
Robert Fancsik 238f9aab4a Tagged template literal array should be marked after construction (#4420)
This patch fixes #4385.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-08 13:07:34 +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
Robert Fancsik 0a3aa0f48b Proxy.[[Set]] should reject falsish trap result in strict mode (#4418)
This patch fixes #4398.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-07 17:25:29 +01:00
Robert Fancsik 979a0c7826 Fix bytecode emitting for invalid regexp literals (#4422)
This patch fixes #4408.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-07 17:19:52 +01:00
Péter Gál 7972386412 Fix shifting a negative value when using BigInts (#4429)
When shifting a negative BigInt value if the
shift count is very "big" the result should be -1.

eg.:
```
(-2n >> (2n*32n)) === -1n
```

Note: the `-2n >> (2n*31n)` already returned `-1n` prior this change.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-07 12:45:10 +01:00
Robert Fancsik 6dfd02a08c Bound function 'length' property should be early initialized (#4421)
This patch fixes #4402.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-07 12:10:54 +01:00
Robert Fancsik fc701aef6d Fix reference count management in %TypedArray%.prototype.reduce{Right} (#4419)
This patch fixes #4397.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-07 11:59:16 +01:00
Péter Gál 61d172aaaf Don't use property list pointer to store Proxy flags (#4415)
Proxy flags (IsCallable, IsConstructor) can't be stored on the
property list compressed pointer. As adding a Proxy to a WeakSet
would add a property to the Proxy object causing failures down the line.

The prototype internal "slot" can be used to store there flags as
it is not used in case of Proxies (as per standard).

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-07 11:53:59 +01:00
Zoltan Herczeg 128f18a225 Fix mutable binding creation for realms with proxy this binding (#4370)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-07 11:09:33 +01:00
Zoltan Herczeg 7baaafa405 Fix the return value of jerry_to_property_descriptor function (#4371)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-07 11:09:07 +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
Robert Fancsik 6279670484 Fix lookahead in lexer_check_numbers (#4423)
This patch fixes #4375.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-06 07:30:09 +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
Akos Kiss 5962562e2d Run CI on pushes and PRs to all branches (#4395)
This helps testing on forks before opening a PR to the main repo.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-05 11:56:32 +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
Robert Fancsik 68b47f5f30 Update packages before installing them (#4388)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-12-29 21:17:10 +01:00
Yonggang Luo 83f9c38ed1 Completely remove JERRY_ATTR_SECTION (#4383)
PR #2903 removed only a part of JERRY_ATTR_SECTION.

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2020-12-29 09:02:20 +01:00
Zoltan Herczeg 9676500add Implement get proxy target (#4367)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-12-18 10:58:48 +01:00
kisbg 1937f820e1 Added new target support to Boolean, String, Number Object (#4368)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-12-17 09:44:59 +01:00
Zoltan Herczeg e2be8f4c79 Get the 'this' binding of a realm value (#4365)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-12-16 13:21:20 +01:00
Péter Gál 6083259030 Add missing version information in API reference document (#4363)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-12-15 11:19:22 +01:00
Péter Gál 035e5a27fa Correctly release wrapper object in JSON stringify (#4361)
When an error occurs accessing a property during JSON stringify call
the wrapper object is not freed at the correct place.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-12-15 11:18:14 +01:00
Péter Gál fe216d4710 Add missing BigInt type for value type query API (#4362)
Extended the `jerry_type_t` enum with `JERRY_TYPE_BIGINT` and added it to
the `jerry_value_get_type`.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-12-15 11:17:11 +01:00
Péter Gál 9380d93416 Fix assert in BigInt TypedArray filter and reduce methods (#4364)
The assert in the reduce and filter methods did not checked if the given value
is a BigInt. This missing check caused the assert to fail.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-12-15 11:14:58 +01:00
Peter Marki 0b72150190 Add cbc flush before statement parsing in constructors (#4358)
Fixes #4238

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2020-12-15 11:13:32 +01:00
Zoltan Herczeg 29be24f056 Fix var and function declaration in eval (#4360)
Fixes #4149

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-12-14 11:30:45 +01:00
Zoltan Herczeg fe29bf7390 Allow changing the 'this' binding of a realm (#4357)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-12-14 10:05:30 +01:00
Zoltan Herczeg 7e135b04ed Fix literal printing in byte code dump. (#4359)
Fixes #4353

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-12-11 13:59: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
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
Dániel Bátyai 1cb18f0ca6 Run tests with mem-stress-test enabled (#4278)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-12-04 10:58:06 +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
Péter Gál 577a605ead Correct syntax error printing in case of end of file (#4350)
The old variant of the syntax error printing method could incorrectly
over-read the source file contents.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-12-01 11:29:54 +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
Virag Orkenyi 19011258d8 Fix the optional argument problem in typedarray_prototype_reduce_... (#4323)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-11-26 12:06:22 +01:00
Péter Gál 3af3597f2e The constructor check should return false for arrow and generator functions (#4328)
The previous `ecma_is_constructor` implementation did not checked if the
target function was an arrow or generator function. This resulted in
an incorrect execution for these function types.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-11-24 12:46:44 +01:00
Péter Gál cc52282f34 Correctly mark the arguments.callee value in gc (#4345)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-11-24 05:19:16 +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 d2c523b2c0 Use correct flag when checking for static snapshot in arguments object (#4343)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-11-19 11:23:44 +01:00
kisbg 7de7c2168e Implement asInteger, asUint32 and asInt32 jerry api methods (#4325)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-11-18 07:37:56 +01:00
Péter Gál 5d916fb8d4 Correctly handle the Proxy IsCallable and IsConstructor information (#4264)
The `IsCallable(target)` and `IsConstructor(target)` info
can't be stored in the target/handler values.
If the input for the ProxyCreate was a revocable Proxy the original target's
callable/constructor information must be retained even after the
Proxy was revoked.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-11-17 10:38:25 +01:00
Akos Kiss 7262b98021 Add script to extract JerryScript version from headers (#4333)
This can be used at configuration time to
- display version in diagnostics, and
- to write proper version number in pkgconfig files.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2020-11-17 10:36:13 +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
Virag Orkenyi fab35c3f93 Fix the indexing problem in typedarray_prototype_index_of & last_index_of (#4305)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-11-16 15:43:55 +01:00
Virag Orkenyi f7b7873a02 Extend Jerry API & API documentation with regex flags (#4246)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-11-16 15:42: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
Akos Kiss 81702ff5ea Drop the minimal variant of the default port implementation (#4331)
The minimal variant became quite meaningless lately. There were two
port APIs originally that had extra functions in the default port
in addition to the core-mandated implementations: the I/O and
Termination port APIs. However, the extra Termination API code was
removed a year ago, leaving some minimal extension in the I/O port
only. As the overhead of the extension is negligible, it is not
worth maintaining two library variants.

Therefore
- this commit removes the minimal variant of the default port lib,
- rewrites uses of the minimal variant to use the variant with the
  I/O extension, and
- updates targets where I/O port code was copy-n-pasted.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2020-11-16 11:54:01 +01:00
Csaba Osztrogonác c57938e0c7 Run test262-esnext tests with larger heap (#4337)
built-ins/RegExp/CharacterClassEscapes tests need more memory than 512Kb.
Additionally increase the timeout to make all tests pass on GitHub CI.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-11-16 11:52:35 +01:00
Akos Kiss 32674f9733 Fix name of install directory of jerry-libm header(s) (#4332)
All installed headers and header directories of the project have
the `jerryscript-` prefix, except the math library, which installed
its `math.h` under `jerry-libm` directory.

This commit changes the name of the include directory to
`jerryscript-libm` to align it with the rest of the project.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2020-11-12 11:00:11 +01:00
Akos Kiss 40004da163 Fix tabulation of configuration messages (#4330)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2020-11-12 10:57:59 +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 b2084e0a02 Implement from and to property descriptor API function (#4245)
Also added two new helper method:
ecma_property_descriptor -> jerry_property_descriptor converter method
jerry_property_descriptor -> ecma_property_descriptor converter method

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-11-03 14:27:26 +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
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
Daniella Barsony 3bad85b83b Add Boolean Prototype Dispatcher (#4308)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-10-29 12:24:32 +01:00
Daniel Balla b7ca097436 Property key filter API (#4311)
Co-authored-by: Robert Fancsik <frobert@inf.u-szeged.hu>

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2020-10-29 11:10:21 +01:00
Daniel Balla e681adce05 Fix sweeping ecma_promise_value_thunk function objects (#4312)
Fixes #4214

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2020-10-29 10:50:37 +01:00
Daniella Barsony 72c92d6b36 Add Array Builtin Dispatcher (#4310)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-10-29 10:49:36 +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
Daniella Barsony 484e999dec Add Promise Prototype Dispatcher (#4309)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-10-28 15:09:17 +01:00
Csaba Osztrogonác 3115d4dc16 Implement DataView.prototype.{set, get}Big{U}int64 methods (#4315)
Co-authored by Adam Szilagyi aszilagy@inf.u-szeged.hu

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-28 11:46:52 +01:00
Ádám Kallai 2007188373 Add lazy load of exclude_list in test262-harness (#4317)
This PR aims to avoid serializing the exclude_list
before each test_case.

test-262-esnext execution takes only ~2 mins (8-thread).

JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2020-10-28 10:34:08 +01:00
Csaba Osztrogonác 24a5489331 Implement ToIndex abstract operation (#4287)
https://www.ecma-international.org/ecma-262/11.0/#sec-toindex

Made DataView constructor, DataView.prototype.setXXX/getXXX methods ES11 conform.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-27 10:37:50 +01:00
Daniella Barsony d5d27afd39 Add Dispatcher for Promise Builtin (#4307)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-10-22 13:21:33 +02:00
Virag Orkenyi 49c633210a Fix assertion fail in typedarray_prototype_to locale_string (#4285)
Change typedarray_prototype_to_locale_string_helper to use ecma_op_invoke_magic_id instead

JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-10-22 12:49:40 +02:00
Zoltan Herczeg 91e0cfc767 Implement ES11 globalThis (#4306)
Also improve symbol built-in instantiation.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-10-22 10:59:54 +02:00
Csaba Osztrogonác a65988798c Uncontrolled memory allocation in jerry_port_read_source function (#4282)
jerry_port_read_source should exit with error message
if its parameter is a directory and not a regular file.

Fixes #4251.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-22 09:05:51 +02:00
Philippe f303017542 espressif's ESP-IDF port (#4270)
JerryScript-DCO-1.0-Signed-off-by: Philippe pgu-swir@users.noreply.github.com


Co-authored-by: Philippe <pgu-swir@users.noreply.github.com>
2020-10-21 19:56:59 +02:00
Csaba Osztrogonác 8a0a86e3c7 Fix the build without BigInt support (#4304)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-21 10:04:59 +02:00
Zoltan Herczeg 6f25d6ed31 Improve JerryScript debugger (#4299)
- Support print (p) as alias to eval (e)
- Fix backtrace processing (incorrect increment when cpointer is 4 byte long)
- Support partial names for pending breakpoints (similar to normal breakpoints)
- Don't print newline after pending breakpoint dialog text
- Add jerryscript-debugger-transport.h to all-in-one build

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-10-19 15:26:19 +02:00
Roland Takacs 3c9a7915e1 Initialize variable to eliminate may be used uninitialized warnings (#4297)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs roland.takacs@h-lab.eu

Co-authored-by: Roland Takacs <roland.takacs@h-lab.eu>
2020-10-19 14:32:40 +02:00
Daniel Balla 870dbff1c7 Don't ref arguments object bytecode in case of static snapshots (#4298)
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2020-10-19 14:31:55 +02:00
Ádám Kallai 23e9e773e0 Fix implicit 'double' conversion reported by Clang (#4296)
JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2020-10-19 14:30:43 +02: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
Csaba Osztrogonác 9da1211e26 Fix HAVE_TM_GMTOFF check for older CMake. (#4292)
Older CMake (for example 2.8.12.2) generates feature check with unused
variable, which reports false positive fail due to -Werror=unused-value.
The feature is present and works, so we should only ignore this build warning.

Fixes #2791.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-17 11:32:47 +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
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
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
Ádám Kallai f6cf1400bd Fix implicit 'double' conversion reported by Clang 12.0.0 (#4288)
JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2020-10-14 11:43:27 +02:00
Csaba Osztrogonác 2a8f1dcbc3 Annotate test262-esnext-excludelist.xml (#4281)
Group unsupported ES features and add comments
to clarify which test files test which feature.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-12 14:24:31 +02:00
Zoltan Herczeg 3c2a3f5dd9 Implement environment record for class constructors (#4207)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-10-12 13:13:38 +02:00
kisbg d317124650 Update JSON stringify to conform ES11 standard (#4176)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-10-12 13:04:08 +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 d1f73752ff Error should be thrown later when calling super multiple times (#4256)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-10-10 18:58:31 +02:00
Daniel Balla 596964ae0d Update jerry_run_all_enqueued_jobs() function and documentation (#4283)
Make sure it always returns an error or an undefined value.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2020-10-10 09:03:52 +02:00
Robert Fancsik e3481d431b Revise the API ArrayBuffer related operations (#4284)
- External ArrayBuffer construction with 0 length should be equivalent to `new ArrayBuffer(0)`
- Internally allocated ArrayBuffers should be detachable
- Externally allocated ArrayBuffers free callback should be called when underlying buffer is detached

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-10-09 15:12:45 +02:00
Dániel Bátyai 5b9a6deb93 Replace fast path should keep a reference to the executed bytecode (#4277)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-10-08 10:02:43 +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
Dániel Bátyai c905c21abb Fix flag handling when creating arguments objects (#4272)
Member variables of the object must be initialized before setting the
required flags, otherwise the uninitalized values can cause problems
during garbage collection.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-10-08 09:58:44 +02:00
kisbg 148f69f4a5 Add new target support for object create (#4203)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-10-07 15:07:25 +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
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
Virag Orkenyi fb1c21beb7 Change guarding of ecma_is_value_bigint and ecma_is_value_symbol (#4269)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-10-05 14:43:04 +02:00
kisbg a084fdbe45 Add a new check for array.prototype.sort in array prototype dispatch (#4208)
Bugfix: first check arguments callable then the length of the this value.

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-10-05 11:26:01 +02:00
Péter Gál 8edf8d6eea Remove revoked Proxy checks when creating a Proxy (#4261)
In the newer ecma262 standard (post ES11) the ProxyCreate was
changed and the revoked Proxy handler/target is not checked.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-10-05 10:03:49 +02:00
Robert Fancsik 37d6b13891 Fix Symbol.description API reference count management (#4267)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-10-02 11:08:57 +02:00
Csaba Osztrogonác 7458766033 Date.parse should reject out of range values (#4248)
The spec doesn't say explicitly that Date.parse should call TimeClip
abstract operation at the end. But Date object can represent time
values only in the range 1970 Jan 01 +/-8,640,000,000,000,000 ms.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-02 10:39:52 +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
Csaba Osztrogonác 8fe3891b15 Fix Date.parse to handle times without timezone properly (#4249)
https://www.ecma-international.org/ecma-262/11.0/#sec-date.parse
"When the UTC offset representation is absent, date-only forms are
interpreted as a UTC time and date-time forms are interpreted as a local time."

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-01 16:34:59 +02:00
Csaba Osztrogonác e227634b45 Make Date.UTC to conform to the latest ES11 spec (#4250)
Date.UTC should work with only one argument too.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-01 16:34:09 +02:00
Zsolt Borbély aa89d38df3 Various minor improvements to reference document (#4259)
- add version notes in case of JERRY_TYPEDARRAY_BIGINT64, JERRY_TYPEDARRAY_BIGUINT64
 - add code highlight to type values (JERRY_INIT_MEM_STATS_SEPARATE, JERRY_INIT_MEM_STATS_SEPARATE)
 - add newlines to break the version notes into separate lines
 - add missing periods

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2020-10-01 13:10:42 +02:00
Dániel Bátyai b9e4897c71 Fix the value of the caller property of function instances (#4258)
We do not support the caller information for functions, and since a
'null' value represents that there has been no caller, the default value
should be changed to 'undefined' to signal that the information is not
available.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-10-01 12:10:11 +02:00
Dániel Bátyai 69d9b2c326 Check that this binding is initialized before forming a super reference (#4255)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-10-01 11:21:00 +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
Péter Gál 0ffe1665bd Fix a typo in case of single thread/process execution in test262 harness (#4223)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-09-28 16:14:23 +02:00
Philippe f97c0134d7 Fix compilation warnings when using 32-bit floats (#4199)
JerryScript-DCO-1.0-Signed-off-by: Philippe pgu-swir@users.noreply.github.com
2020-09-28 16:12:21 +02:00
Dániel Bátyai 9f93b0a8ee Fix Symbol to Object comparison (#4226)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-09-28 16:01:38 +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
Zoltan Herczeg 32de38198a Fix invalid free in TypedArray find method. (#4230)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-09-28 10:48:14 +02:00
Csaba Osztrogonác c4388e2c19 Fix memory leak in ecma_op_abstract_relational_compare (#4235)
Fixes #4234.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-09-28 10:29:25 +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
Csaba Osztrogonác de38764e88 Fix heap buffer overflow in Array.prototype.copyWithin (#4211)
2nd and 3rd argument evaluation of Array.prototype.copyWithin can change
the length of the array as a side-effect. But ES11 spec says that the
algorithm should use the original length. In this case it could happen
that the underlying buffer should be extended.

Fixes #4204

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-09-25 15:06:29 +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
Csaba Osztrogonác e478640d80 Add --buildoption-test to CI (#4236)
run-tests --buildoption-test was previously tested on Travis CI,
but wasn't added to GitHub CI accidentally.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-09-25 14:20:49 +02:00
Péter Gál 0745feb670 Do module cleanup at a later stage (#4209)
Module info should be freed at a later stage to correctly have
all module data in every step during the execution.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-09-25 14:05:46 +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
Csaba Osztrogonác 3b7409f3a7 Run test262 tests on CI on Ubuntu 20.04 (#4232)
The timeout utility in Ubuntu 18.04 (GNU CoreUtils 8.28) has a bug which
caused false positive test failures regulary. This bug is already fixed
in CoreUtils, and Ubuntu 20.04 LTS shipped the fixed version of timeout.

https://github.com/coreutils/coreutils/commit/cbf35912da66a17a6113d5a434214dd7651f403a

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-09-24 13:32:32 +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
Zoltan Herczeg 3c723c9bc1 New jerry_get_symbol_description API function (#4206)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-09-21 10:39:38 +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
Dániel Bátyai 55554535b2 Update Promise.all/race to ES11 (#4202)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-09-18 14:05:48 +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
Dániel Bátyai f4af997935 Update NuttX repository URLs (#4201)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-09-17 18:15:40 +02:00
Virag Orkenyi 1be9573925 Separate ecma_builtin_helper_string_find_index into two parts (#3978)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-09-17 15:38:36 +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
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
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
Péter Gál f8983cd2b5 Allow parallel test execution in test262 for ES2015 and ESNEXT (#4182)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-09-14 17:30:38 +02:00
Csaba Osztrogonác f834340608 Fix test262 excludelist update on Windows (#4185)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-09-14 17:29:57 +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
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
Peter Marki 861bb82749 Update ES6 exclude list: Reflect.enumerate is obsolete since ES2016 (#4181)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2020-09-08 10:02:52 +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
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
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
Tóth Béla ed63665901 Fix whitespaces in BigInt constructor (#4152)
JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-09-01 15:26:43 +02:00
Robert Fancsik 1fd0cac8c9 Introduce new API function to obtain well-known symbols (#4163)
- jerry_get_well_known_symbol

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-08-31 10:03:05 +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
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
Robert Fancsik cd1c06510e Support BigInt64/BigUint64 typedarray creation from API (#4170)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-08-28 13:14:40 +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
Dániel Bátyai e98f5342f9 Fix leaking lastIndex values in RegExp built-ins (#4166)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-08-28 13:09:53 +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
Péter Gál 4ed9e2c033 Correctly report error in for-in start in case of proxies (#4165)
In case of Proxies the "ownKeys" call can return an incompatible
value for a for-in statement. In such cases the error should be
propagated to the user.

Fixes: #4159

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-08-28 12:46:35 +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
Csaba Osztrogonác a6cd19fa6e Annotate test262-esnext-excludelist.xml (#4171)
Group stage 4 and stage 3 tests by proposals.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-27 13:20:18 +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
kisbg 59ab36088f Check argument is bigint in create_object_arg (#4142)
fixed #4138

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-27 09:04:46 +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
Csaba Osztrogonác 55b6b1aed7 Fix memory corruption (bad-free) in ecma_string_pad (#4164)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-24 15:01:49 +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
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 5b3f01af9d Add missing error support for API functions. (#4153)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-19 11:13:08 +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
kisbg d9cb2c60f2 fix check order in ecma_op_abstract_equality_compare (#4141)
Fixes #4139

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-18 13:50:58 +02:00
kisbg 086d1cc127 Added missing object deref in ecma_promise_reject_or_resolve (#4144)
fixes #4131

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-17 11:06:44 +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 8964a2bd18 Optimize test262 runner (#4120)
Changes:
- Add new option to run-tests.py: --test262-test-list to run selected tests only
- Fix exclude list updater accordingly
- Run ESNext tests on GitHub CI in two batches to decrease runtime

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-13 13:47:14 +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
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
Dániel Bátyai 5ce95be174 Mark the lexical environments of running executable objects (#4133)
Fixes #4094.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-08-12 20:50:48 +02:00
Dániel Bátyai 79540727ab Append promise reaction values in a gc safe manner (#4127)
Fixes #4096.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-08-12 20:45:07 +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
Dániel Bátyai 0c154306a8 Fix yield* with undefined return method. (#4126)
Fixes #4097.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-08-11 14:01:18 +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
Dániel Bátyai 286e515f9f Fix mem-stress-test to properly run gc before allocs (#4125)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-08-11 09:51:43 +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
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 25117ad56b Fix whitespace ranges for ES.next profile (#4110)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-08-06 14:26:41 +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
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
kisbg 7d479ad91b Update proxy to ES2020 (#4085)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-06 11:25:29 +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 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
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
Csaba Osztrogonác 621a5ddb8f Test262 results should be uploaded always (#4106)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-04 16:54:53 +02:00
Csaba Osztrogonác 401b36d406 Make test262 output less verbose (#4108)
Changes:
- Progress meter is precise and less verbose
- Omit list of failures, test262.report file contains it

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-04 16:54:06 +02:00
Zoltan Herczeg bdb39f1f03 Implement binary bitwise BigInt operators (#4105)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-04 16:53:38 +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
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 be9dbeffdb Fix AdvanceStringIndex to return an ecma_length_t (#4100)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-08-04 09:08:34 +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
Péter Gál e9b794f629 Fix propery name duplication check in case of empty collection (#4098)
Fixes: #4093

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-08-03 17:27:50 +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
Csaba Osztrogonác f1eba9f826 Make Test262 results less verbose (#4090)
Changes:
- Don't dump each test output to stdout
- Upload test outputs as artifact to GitHub

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-03 10:40:26 +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
Dániel Bátyai 84125275ea Make sure modules are evaluated when creating a namespace object (#4081)
Fixes #4076.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-31 17:19:05 +02:00
Dániel Bátyai 611c8827ba Improve case conversion related fast paths (#4083)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-31 16:25:32 +02:00
Csaba Osztrogonác 40ad8c6e45 Add --test262-esnext option to run-tests.py (#4027)
Changes:
- Imported and unified test262 test harness for ES2015 and ESNext
- Simplified runner scripts accordingly
- Run tests on CI to be able detect regressions and progressions too

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-07-31 15:52:45 +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
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
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
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
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
Péter Gál 51aee962a4 Fix inline errors with fPIC (#4078)
In case of `-fPIC` and single file build one of the Regexp's method
raises an error during linking:

```
ecma-regexp-object.c: In function ‘ecma_regexp_run’:
re-bytecode.c:258:1: error: inlining failed in call to ‘always_inline’ ‘re_get_value’:
 function body can be overwritten at link time
```

By adding the `inline` keyword for the method the build error can be resolved.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-28 14:36:45 +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
Dániel Bátyai edab1964c2 Improve source file handling in jerry-main (#4037)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-28 10:51:16 +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
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
Péter Gál 227007eda7 Fix TypedArray construction with incorrect offset (#4075)
In case of a TypedArray the input `byteOffset` argument must be a
multiple of the `BYTES_PER_ELEMENT` value.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-27 20:05:51 +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
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 39e2bc4df4 Fix new.target saving in OrdinaryObject.[[Construct]] (#4060)
This patch fixes #4059.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-27 19:32:54 +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
Dániel Bátyai 3f0f9589c4 Fix the length values of Promise built-in functions (#4041)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-27 11:07:25 +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
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
Dániel Bátyai cf097ca16b Fix values of properties that reference intrinsic function objects (#4024)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-24 12:54:54 +02:00
Szilagyi Adam 54bfd2ba37 Implement Promise.prototype.onFinally (#3987)
The algorith is based on ECMA-262 v11, 25.6.5.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-24 12:54:16 +02:00
Csaba Osztrogonác 539928dbdb Fix date-construct.js test (#4020)
Removed an undeterministic subtest.

date-construct.js fails intermittently, because it expects that
two Date() calls return the same date string. But the second one
can be 1 second later. This subtest is undeterministic and already
covered by test262/es2015/test/built-ins/Date/S15.9.2.1_A2.js with
1 second epsilon.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-07-24 12:48:31 +02:00
Tóth Béla 2f2a4e066c Implement String.padStart and String.padEnd (#3999)
Based on: https://tc39.es/ecma262/#sec-string.prototype.padstart

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-07-24 11:24:18 +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
Mátyás Mustoha fdb5d893bf Update Mbed OS target to 5.15.4 (#4035)
JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha matyas.mustoha@h-lab.eu
2020-07-23 13:35:54 +02:00
Zoltan Herczeg d92d9db40f Fix property name comparison when external strings are used. (#4033)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-22 15:17:39 +02:00
Rafal Walczyna a4952da831 Change heap sort to merge sort for Array.prototype (#4026)
ES11 requires Array.prototype.sort to be stable

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-07-22 13:33:07 +02:00
Zoltan Herczeg 0124368ae7 Implement external strings. (#4028)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-22 12:27:12 +02:00
Szilagyi Adam 04f0a7a670 Add missing error check to ecma_builtin_regexp_prototype_compile (#4022)
Fixes #4017

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-21 16:06:35 +02:00
Dániel Bátyai 1eef69f24d Update lastIndex handling in RegExpBuiltinExec (#4010)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-21 15:13:51 +02:00
Dániel Bátyai 69f6bc6566 Fix word boundary assertions with both unicode and ignoreCase flags (#4008)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-21 15:13:06 +02:00
Daniella Barsony 12ee41602e Add custom Regexp.prototype dispatcher (#3979)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-07-21 12:46:59 +02:00
Szilagyi Adam 2fac7cc85e Refactor Number.prototype methods toFixed, toExponential, toPrecision (#3911)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-21 12:46:03 +02:00
Csaba Osztrogonác fee3c295a2 Fix test262 excludelist updater (#4023)
The previous fix was buggy, header and footer shouldn't be duplicated.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-07-20 19:09:44 +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
Dániel Bátyai 321215fdbb Update RegExp unicode mode case folding to conform to the standard (#4004)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-20 15:51:43 +02:00
Szilagyi Adam 33359ac506 Implement UnicodeEscape abstract method (#3959)
Also refactored ecma_builtin_json_quote to use the method above

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-20 13:51:06 +02:00
Csaba Osztrogonác b162e27418 Fix test262 excludelist updater (#4021)
tools/run-tests.py --test262-es2015 update shouldn't
remove comments and newlines in the excludelist file.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-07-20 13:47:45 +02:00
Szilagyi Adam e8c5c46894 Implement Symbol.prototype.description (#3995)
The algorithm is based on ECMA-262 v11, 19.4.3.2

Also added a custom dispatcher for the Symbol prototype

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-20 13:47:25 +02:00
Dániel Bátyai 74781c28c2 Fix sticky flag handling in @@replace (#4005)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-20 12:54:06 +02:00
Dániel Bátyai c2bfdde806 Restore previous group start after a failed non-capturing group (#4002)
Fixes #3934.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-20 12:47:45 +02:00
Dániel Bátyai f6cde17bfb Update @@search to conform to ES11 standard (#4003)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-20 12:46:49 +02:00
Dániel Bátyai b7fa4afb66 Global @@match result array should always contain strings (#4011)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-20 12:17:07 +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
Csaba Osztrogonác f60e16d9d5 Fix GetCapabilitiesExecutor function (#4006)
Changes:
- Remove false assert, executor can be invoked by 0 or 1 parameters too
- Update steps and spec references

Already covered by test262 (ESnext) tests:
- built-ins/Promise/*/capability-executor-called-twice.js
- built-ins/Promise/*/capability-executor-not-callable.js

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-07-16 16:05:48 +02:00
Szilagyi Adam 604cfaced4 Implement Array.prototype.includes (#3991)
The algorithm is based on ECMA-262 v11, 22.1.3.13

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-15 19:21:24 +02:00
Péter Gál c8d15ddbf7 Date.protoype.toJSON should look for toISOString once (#3996)
The toJSON method should be searched on the `this` object
only once. In case of normal objects there were no problems
however when a Proxy object is used as the `this` argument
for the Date.prototype.toJSON method the Proxy's `get` method
was invoked twice.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-15 17:12:55 +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
Mátyás Mustoha 870a3d3ffb Update the NuttX-STM32 documentation (#3986)
Fixed and updated some of the repository locations and the
relevant build commands.

- Updating `stlink` fixes a CMake build error on the 1.5.1 branch
- Updating the `kconfig` build command allows creating `kconfig-tweak`,
  which fixes a warning during the NuttX configuration

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2020-07-10 16:09:13 +02:00
Robert Fancsik 37906baa25 Rework promise internal structures (#3985)
- Capabilities
- Promise all resolver

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-10 16:08:34 +02:00
Szilagyi Adam dfabfe7a56 Add missing isArray checks based on the ES11 standard (#3983)
Added checks to the following methods:
- ecma_builtin_json_stringify, ECMA-262 v11, 24.5.2
- ecma_builtin_json_internalize_property, ECMA-262 v11, 24.5.1.1

Fixes #3945
Fixes #3950

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-10 16:06:27 +02:00
Robert Fancsik b90fa63255 LEXER_ASSIGN_GROUP_EXPR should not be emitted when parsing LHS expression (#3990)
This patch fixes #3935.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-10 08:35:33 +02:00
Roland Takacs 35e1e98008 Fix Object.assign to call [[GetOwnProperty]] Proxy handler only once (#3988)
Removed the enumerable option when listing properties to prevent an extra
[[GetOwnProperty]] function call for Proxy objects.
In this case all the property names are collected, but the Object.assign()
implementation has already taken care of the enumerable property filtering.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-07-09 10:23:43 +02:00
Péter Gál ae5cfae3e7 Implement ToPropertyKey operation (#3966)
From ES 6 the ToPropertyKey operation is used to convert elements to a valid property key.
This "new" method uses the ToPrimitive operation which can call the `@@ToPrimitive`
well-known symbol to convert the given element to a key.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-06 15:17:18 +02:00
Csaba Osztrogonác ed9e3eccf9 Make Date constructor conform to the latest spec (#3972)
Date constructor called with 1 argument should accept Date objects too.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-07-06 14:47:10 +02:00
Robert Fancsik c1e90da0b4 Support Unicode supplementary planes (#3928)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-06 14:21:13 +02:00
László Langó 7353b253ab Fixed memory leak in %TypedArray%.prototype object's 'sort' routine. (#3981)
The buffer of values were not freed properly when an exception was
thrown in the compare function.

Fixes #3975

JerryScript-DCO-1.0-Signed-off-by: László Langó lango@inf.u-szeged.hu
2020-07-06 13:42:27 +02:00
Csaba Osztrogonác b6183baf84 Fix tools/runners/run-test-suite.py with Python 3.6 (#3982)
text parameter of Popen introduced in Python 3.7,
we should use the equivalent universal_newlines.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-07-06 13:38:50 +02:00
Szilagyi Adam 69f917650e Update parser early return type in ESNEXT (#3742)
This patch updates the early return types in the parser to SyntaxError instead of ReferenceError
in ESNEXT

This patch also includes a lot of tests for LeftHandSideExpression validation when using the = operator

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-06 13:36:28 +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
Csaba Osztrogonác 5f951bb4f1 Fix TimeWithinDay(t) abstract operation (#3974)
Fixes #3973.

TimeWithinDay(t) = t modulo msPerDay, where msPerDay = 86400000.
The sign of the modulo operation result should be same as the right side
per definition, conseqently TimeWithinDay(t) >= 0.

References:
- https://www.ecma-international.org/ecma-262/11.0/#sec-mathematical-operations
- https://www.ecma-international.org/ecma-262/11.0/#sec-overview-of-date-objects-and-definitions-of-abstract-operations

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-07-06 08:12:07 +02:00
Szilagyi Adam 392ee71712 Remove ECMA_TRY_CATCH macro (#3829)
also refactored the touched methods a little bit

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-03 15:06:49 +02:00
Robert Fancsik 19ecd8717f Fix property redefinition (#3970)
The previously allocated property should not be deleted only it's type should be change.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-03 14:13:47 +02:00
Robert Fancsik f98d7f24a7 Support super property reference in object methods/accessors (#3940)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-03 12:16:23 +02:00
Zoltan Herczeg 80716cca90 Implement missing async function and async iterator prototypes. (#3962)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-03 11:04:27 +02:00
Zsolt Borbély f86b78a886 Fix the configuration of stack measurement in jerry-test (#3971)
Build command via CMake parameter:
```
tools/build.py --jerry-cmdline-test=on --cmake-param=-DJERRY_TEST_STACK_MEASURE=ON --compile-flag=-static
```

Build command via compile flag:
```
tools/build.py --jerry-cmdline-test=on --compile-flag=-DJERRY_TEST_STACK_MEASURE=1 --compile-flag=-static
```

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2020-07-02 17:12:13 +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
Péter Gál eb77f96d20 Add simple stack measure for jerry-test (#3717)
This change introduces simple stack measuring by coloring the stack
before doing the actual JS work.

The dynamic linking should be avoided as it will use the stack during
the symbol resolving.

At this moment the `JERRY_STACK_MEASURE` compile time define will enable
the measurement for the jerry-test binary.

A usable build configuration:

```
./tools/build.py --jerry-cmdline-test=on --compile-flag=-DJERRY_STACK_MEASURE=1 --compile-flag=-static
```

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-02 11:54:52 +02:00
Szilagyi Adam cd1e067671 Update Promise.race and Promise.all to ES11 (#3954)
Changes based on ECMA-262 v11, 25.6.4.4 and 26.6.4.1 step 3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-02 11:46:07 +02:00
Péter Gál 55d6637da5 Fix Date.prototype[@@toPrimitive] hint handling (#3967)
The Date.prototype[@@toPrimitive] only allows the "string", "default" and "number"
hint values. Any other value should throw a TypeError.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-02 11:40:08 +02:00
Csaba Osztrogonác e943d12286 Speedup AppVeyor CI runtime (#3965)
There is no good reason to test JERRY_DEBUGGER=OFF configuration too,
because debugger itself contains Windows specific codepath. If the
build works with debugger, it has to work without debugger too.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-07-01 19:51:58 +02:00
Péter Gál 0c61aee597 Improve the JSON C API (#3943)
* Added more details into documentation.
* Moved the C unit-test into its own file.
* Added extra test cases.
* Extended the API reference documentation with doctests.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-01 14:50:39 +02:00
Péter Gál ca12a8f8f4 Fix JSON.stringify empty array replacer handling (#3938)
In case of an empty array is used as a replacer for the JSON.stringify,
the output string should not contain any keys.

Fixes: #3926

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-01 12:41:34 +02:00
Zoltan Herczeg 6389816f67 Implement AsyncIteratorClose for for-await-of statement. (#3955)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-01 12:40:39 +02:00
Roland Takacs dc3165533e Support symbol property names in Object.defineProperties (#3933)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-07-01 12:38:20 +02:00
Csaba Osztrogonác 0deeb39ebf Fix Object.prototype.toLocaleString() and Array.prototype.toLocaleString() (#3953)
Since ES6 Object.prototype.toLocaleString() shouldn't call ToObject() and
Array.prototype.toLocaleString() shouldn't call ToObject() for each element.
References:
- https://www.ecma-international.org/ecma-262/11.0/index.html#sec-array.prototype.tolocalestring
- https://www.ecma-international.org/ecma-262/11.0/index.html#sec-object.prototype.tolocalestring

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-07-01 12:05:54 +02:00
Csaba Osztrogonác 1064b19cfb Class accessors shouldn't be enumerable. (#3961)
Reference:
https://www.ecma-international.org/ecma-262/11.0/index.html#sec-runtime-semantics-classdefinitionevaluation 21.a,b

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-07-01 12:03:49 +02:00
Csaba Osztrogonác b57e9cbc27 Symbol.prototype[Symbol.toPrimitive].length should be 1 (#3960)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-07-01 08:54:58 +02:00
Zoltan Herczeg 37049c4968 Support catch statement without argument. (#3956)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-30 18:00:40 +02:00
Rafal Walczyna 9d2b7334bc Update Symbol.split functions for String and Regexp to match new standard (#3942)
In newest ES standard limit parameter is calculated using
ToUint32 function instead of ToLength.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-06-30 16:03:11 +02:00
Mátyás Mustoha 3e866258db Update NuttX to 9.0 on Travis (#3958)
Update the Travis builds to use NuttX 9.0, which was
released on April 26, 2020.

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2020-06-30 15:53:29 +02:00
Ruzsinszki Gábor ed6689ab8f Adds support for compiling with MSYS and MINGW under windows (#3949)
JerryScript-DCO-1.0-Signed-off-by: Ruzsinszki Gábor ruzsinszki.gabor@gmail.com
2020-06-30 14:07:08 +02:00
Zoltan Herczeg cd949d9d64 Rework flags representing arrow functions and complex arguments (#3957)
This allows detecting cases which was not possible before.

Fixes #3944

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-30 14:00:35 +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
Szilagyi Adam c0b594fa69 Remove duplicate is_object check when calling ecma_op_to_primtive (#3899)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-30 13:18:40 +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
Csaba Osztrogonác 89342ea503 Make test262-es2015 output more verbose (#3924)
It makes easier to debug unexpected failures on the CI.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-06-30 12:47:54 +02:00
Zoltan Herczeg 5535ea88ac Implement for-await-of statement. (#3946)
AsyncIteratorClose has not supported yet.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-30 11:21:50 +02:00
Zoltan Herczeg 0b404ea893 Support caching of next method in for-of and built-in methods. (#3939)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-26 14:47:39 +02:00
Csaba Osztrogonác 264bb210c1 Fix profile file parsing in CMake (#3932)
Changes:
- Comment can be started anywhere, not only at the beginning of the input.
- The end of the comment isn't the end of the input, but the first newline.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-06-26 13:46:08 +02:00
Dániel Bátyai 2523323310 Simplify resource name handling (#3929)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-26 12:10:14 +02:00
Zoltan Herczeg b7e3baeecb Support caching of next method in generators. (#3937)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-26 12:09:36 +02:00
Zoltan Herczeg f88489beef Implement yield* operator (#3923)
Missing features:
- caching next() method (this also true for normal generators)
- automatic sync to async generator conversion

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-25 17:11:16 +02:00
Péter Gál c12c60c550 Fix DataView argument handling in case of undefined value (#3930)
The DataView's third argument incorrectly processed the "undefined"
value resulting in a RangeError.

Fixes: #3927

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-06-25 14:05:08 +02:00
Roland Takacs ae17c1184c Implement Object.getOwnPropertyDescriptors built-in method (#3921)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-06-25 12:08:46 +02:00
Zoltan Herczeg 5d8c5f3e92 Support comma after last argument for function declarations (#3910)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-24 10:41:03 +02:00
Rafal Walczyna e64fc9aca9 Remove "arguments" and "caller" from specific functions (#3918)
As stated in ES 16.1, "arguments" and "caller" must not be created in:
- strict functions created using the Function constructor
- generator functions created using the Generator constructor
- async functions created using the AsyncFunction constructor
- functions created using the bind

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-06-22 19:08:13 +02:00
Csaba Osztrogonác 281635cb40 Fix the types of builtin prototype objects (#3922)
ES2015 spec made an incompatible change, many builtin prototypes became
no longer valid instances of their respective classes. But unfortunately
it broke the web, so ES2016 reverted String, Boolean and Number prototype
to the original behaviour (ES5.1). JerryScript should match the latest spec.

references:
- ES11 19.3.3 Properties of the Boolean Prototype Object
- ES11 20.1.3 Properties of the Number Prototype Object
- ES11 21.1.3 Properties of the String Prototype Object

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-06-22 16:31:13 +02:00
Zoltan Herczeg 8ccccd9705 Fix a few small issues in generators (#3919)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-22 13:55:33 +02:00
Zoltan Herczeg b2a6109430 Implement async generators (#3916)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-22 13:54:18 +02:00
Szilagyi Adam 0f0041d720 Make the Set.prototype values, keys and [@@iterator] methods to be one intrinsic method (#3777)
After this patch these methods will be the same function objects

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-18 13:59:31 +02:00
Szilagyi Adam 16750e8171 Use stringbuilder in ecma_builtin_helper_object_to_string (#3807)
Also added steps 4-6 from ECMA-262 v6, 19.1.3.6

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-18 13:55:55 +02:00
kisbg 6a877185fe Added new target support for dataview object (#3764)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-06-18 13:53:30 +02:00
Robert Fancsik fb6ea035d3 Fix signed-off check in tolerant mode (#3915)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-18 13:04:46 +02:00
Szilagyi Adam 5e34a5e978 Refactor ecma_builtin_global_object_decode_uri_helper (#3895)
The main change is the usage of stringbuilder

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-18 11:19:52 +02:00
Szilagyi Adam 0fa07c1275 Refactor ecma_builtin_global_object_encode_uri_helper (#3890)
The main change is the usage of stringbuilder

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-18 11:11:19 +02:00
Szilagyi Adam 59b8e91c39 Refactor ecma_builtin_global_object_escape (#3887)
The main change is the usage of stringbuilder

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-18 11:10:06 +02:00
Robert Fancsik a026a7d713 Fix releasing 'exec' in regexp replace fast path (#3913)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-17 19:24:07 +02:00
Robert Fancsik e0b2f8e0d8 Extend CI list with Github actions (#3905)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-17 17:19:05 +02:00
Daniella Barsony 5d6467930a Add custom dispatcher to Set/Map/WeakSet/WeakMap (#3790)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-06-17 16:07:02 +02:00
Csaba Osztrogonác c55a0baaf8 Improve test262 ES2015 runner (#3892)
Changes:
 - Add options to the test runner to be able to update exclude list
 - Update the exclude list
 - Make Travis CI signal if the exclude list isn't up-to-date

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-06-17 15:42:51 +02:00
Zoltan Herczeg b1912e7224 Fix async function call parsing. (#3909)
The "async" identifier processing is delayed until it is detected that it cannot
be part of an arrow expression. The "async" identifier should be processed at this
point, but it was not happened in this case.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-17 15:35:02 +02:00
Zoltan Herczeg 8e010146a9 Reduce try context stack consumption to 1 from 2. (#3898)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-17 14:39:53 +02:00
Rafal Walczyna 5bcb78482a Remove arguments and caller properties from ArrowFunction (#3906)
As stated in ES11 16.1, ArrowFunction should not have caller and arguments
properties.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-06-17 13:01:16 +02:00
Robert Fancsik cc4ac497b7 Merge jerry-test-suite into jerry tests (#3907)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-17 13:00:41 +02:00
Zoltan Herczeg 8719f72e61 Implement async function execution. (#3897)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-17 12:08:01 +02:00
Daniella Barsony eb8e81d682 Add Generator Prototype custom dispatcher (#3864)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-06-17 11:23:53 +02:00
Csaba Osztrogonác b469f0e9a8 Documentation typo fixes (#3904)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-06-16 18:54:36 +02:00
Zoltan Herczeg 1b2e0aec8c Create extend byte code flags with function types. (#3802)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-15 13:40:55 +02:00
Dániel Bátyai fde0d556ac Re-target for ES.Next (#3901)
A list of changes:
- 'es2015-subset' profile is deprecated, and an 'es.next' profile is added.
- The default profile is changed to 'es.next'
- Renamed the JERRY_ES2015 guard to JERRY_ESNEXT
- Renamed JERRY_ES2015_BUILTIN_* guards to JERRY_BUILTIN_*
- Moved es2015 specific tests to a new 'es.next' subdirectory
- Updated docs, targets, and test runners to reflect these changes

Resolves #3737.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-12 17:55:00 +02:00
Dániel Bátyai c0270c4887 Update API version to 2.4 (#3900)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-12 14:46:59 +02:00
Robert Fancsik 23bba1c6d9 Builtin objects finalization should handle function properties with tagged template literal collection (#3896)
This patch fixes #3893.

Co-authored-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-12 13:01:44 +02:00
Zoltan Herczeg 38111c0889 Fix redeclaration of existing var variables in functions with argument context. (#3891)
Fixes #3888

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-11 11:36:37 +02:00
Péter Gál 01e9670365 Update API version to 2.3 (#3889)
Update the API reference doc also.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-06-10 13:02:30 +02:00
Rafal Walczyna 049a0c43f6 Fix ReferenceError for let/const variables in of/in for loop (#3885)
ReferenceError should be thrown when variable is used before assignment

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-06-10 12:39:02 +02:00
Zoltan Herczeg 1bf52f5847 Fix initializer detection in for-in expressions. (#3884)
Also fix column update when comments are parsed.

Fixes #3882

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-10 12:37:52 +02:00
Dániel Bátyai 6d9d2328e9 Fix built-in RegExp allocation with default constructor (#3883)
Fixes #3880.
Fixes #3881.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-09 12:33:41 +02:00
Robert Fancsik dba9533af1 Compiled code should hold strong reference for the object in the tagged template literal collection (#3876)
This patch fixes #3866.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-09 08:20:30 +02:00
Dániel Bátyai 70383255fc Fix result of Date getters when called on invalid date (#3879)
Fixes #3878.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-09 07:27:31 +02:00
Roland Takacs 585332f072 Fix define_own_property_descriptor to set configurable flag correctly (#3877)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-06-08 18:12:39 +02:00
Zoltan Herczeg 36bf1ec09d Implement argument redefinition with var statement. (#3811)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-08 13:43:50 +02:00
Csaba Osztrogonác a885664220 Builtin objects accessor properties should be configurable (#3839)
http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-standard-built-in-objects

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-06-08 13:22:41 +02:00
Zoltan Herczeg 2058ea1286 Implement eval support for functions with arguments lexical env. (#3806)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-08 12:11:54 +02:00
Dániel Bátyai fed1b0c827 Add missing end-of-string checks to RegExp parser in unicode mode (#3875)
Fixes #3870.
Fixes #3871.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-08 11:09:08 +02:00
Robert Fancsik b7a641c124 Raw string length should be adjusted when UTF8 string is converted to CESU8 (#3853)
This patch fixes #3812.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-08 11:00:34 +02:00
Szilagyi Adam 4c53c94341 Fix value release in vm_loop for Proxy for-in cases (#3874)
Fixes #3868

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-08 10:29:06 +02:00
Szilagyi Adam 90fd881fda Fix TypedArray initialization with another TypedArray (#3850)
Fixes #3836

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-08 10:28:42 +02:00
Zoltan Herczeg 1230d4532c Asterisk should be ignored by object initializers. (#3872)
Fixes #3869

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-08 10:27:42 +02:00
Zoltan Herczeg ab2e821777 Fix three async function issues. (#3863)
- Invalid assert
- Add missing async prefix check when an identifier is enclosed in brackets
- Adding a new byte-code

Fixes #3855
Fixes #3856
Fixes #3857

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-08 10:25:34 +02:00
kisbg c2c623df79 Added missing generator prototype check (#3865)
Fixes #3861

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-06-08 10:25:04 +02:00
Szilagyi Adam 358101f27f Fix string dereference in ecma_op_create_dynamic_function (#3873)
Fixes #3862

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-08 10:23:26 +02:00
Péter Gál ba4e3a402f Correct release of spread arguments (#3867)
During the `opfunc_spread_arguments` argument release process
the stack pointer was incremented early resulting in a state where
one of the arguments was not freed causing a memory leak.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-06-06 18:39:40 +02:00
Dániel Bátyai cae6cd08fb Primitive this values of accessors should not be coerced in strict mode (#3854)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-05 15:58:10 +02:00
Zoltan Herczeg 10e78a4eef Context break should honor private contexts. (#3852)
Fixes #3830

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-05 14:39:13 +02:00
Robert Fancsik 1770ccaecd Object/Array initializers should be parsed as AssignmentExpression (#3851)
This patch fixes #3849.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-05 13:25:05 +02:00
Péter Gál 0d4116933f Fix property descriptor queries (#3840)
When the getOwnPropertyDescriptor method was invoked the input property
descriptor was not cleared in every case. This could lead to problems when
the property descriptor is not set/modified by the getOwnPropertyDescriptor
call, resulting in a failure at a later state.

Related to this the Proxy getOwnPropertyDescriptor method incorrectly returned
"undefined" value in a single case.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-06-05 12:28:34 +02:00
Szilagyi Adam 252cfb0876 Fix length check for Array.prototype indexOf, lastIndexOf and fill (#3798)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-06-05 12:20:26 +02:00
Robert Fancsik c09c2c5dd7 Fix several function name related issues (#3848)
- For non-computed name srcipt functions only identifier/string literal should be set as name
- Implicit class constructor names with non string function name should be ToString-ed

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-04 13:44:22 +02:00
Zoltan Herczeg e6ebc2be78 Don't continue parsing expressions after ternary operators. (#3847)
Further benefits: new code requires less checks.

Fixes #3841
Fixes #3842

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-06-04 13:27:32 +02:00
Robert Fancsik 1414e9bb00 Fix invalid AssignmentExpression lookahead in parser_process_group_expression (#3846)
This patch fixes #3845.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-04 13:23:25 +02:00
Dániel Bátyai 1322e08ac2 Fix parsing function statements containing invalid tokens (#3838)
Fixes #3821.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-04 11:25:25 +02:00
Robert Fancsik fe09200d61 Fix assignment lookahead in parser_process_group_expression (#3828)
This patch fixes #3815 and fixes #3819.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-03 15:29:26 +02:00
Robert Fancsik 4660bab16b Fix PropertyDefinition parsing in ObjectInitializer (#3832)
This patch fixes #3822 and fixes #3823 and fixes #3824 and fixes #3825.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-03 15:28:13 +02:00
Rafal Walczyna a56e31f194 Update ES6 Set and Map "size" accessor descriptors (#3826)
In ES6 accessors of built in object are by default configurable.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-06-02 18:01:45 +02:00
Robert Fancsik dc837d232d Fix incorrect assertion on ecma_op_function_has_instance (#3827)
This patch fixes #3814.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-06-02 16:16:21 +02:00
Dániel Bátyai 9ceece8eb4 Fix string position calculation in @@replace (#3831)
Fixes #3817.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-06-02 16:15:23 +02:00
Dániel Bátyai d06c3a7f50 Fix error handling in SerializeJSONProperty (#3816)
Fixes #3813.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-05-30 19:46:52 +02:00
Robert Fancsik 3b4c259281 Add support for builtin/builtin routine 'name' property (#3810)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-29 14:28:52 +02:00
Robert Fancsik 5895b96bdb Class extends expression should be parsed is strict mode (#3801)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-28 16:23:56 +02:00
Csaba Osztrogonác e76a1381e6 Update test262-es6-excludelist.xml. (#3808)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-05-28 15:10:54 +02:00
Csaba Osztrogonác ab3461b63d Fix tools/run-tests.py --test262-es2015 (#3803)
The output of the test262 runner changed between ES5.1 and ES6,
our script should respect it to signal regressions in return code too.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-05-28 14:30:49 +02:00
Robert Fancsik d4fe48fae4 Script classes should be skipped during 'name' property lazy instantiation (#3809)
This patch fixes the TC262 language/expressions/class/name.js testcase.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-28 14:15:33 +02:00
Robert Fancsik 104001df68 Implement function name support for script functions and classes (#3745)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-28 12:33:21 +02:00
Zoltan Herczeg 562dcc8630 Fix Promise thenable. (#3799)
A single promise can be resolved any number of times due to
thenable functions, but each resolver pair can only be called once.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-28 10:48:44 +02:00
Dániel Bátyai c2b6621702 Fix adding entries to the internal buffer of a Map object (#3805)
When appending the key/value pair separately, garbage collection could be
triggered before the value is added, which could cause problems during
marking. This patch changes insertion to add both values at the same
time, which prevents partial entries from being present in the internal
buffer.

Fixes #3804.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-05-28 07:55:16 +02:00
Szilagyi Adam 7a20150ae7 Fix error handling in Reflect.defineProperty (#3800)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-27 18:57:15 +02:00
Robert Fancsik 69f8e78c2f Fix error handling in scanner when in case of OOM (#3793)
This patch fixes #3786 and fixes #3788.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-27 14:40:43 +02:00
Dániel Bátyai 8f76a1f382 Rework RegExp engine and add support for proper unicode matching (#3746)
This change includes several bugfixes, general improvements, and support
for additional features.
- Added full support for web compatibility syntax defined in Annex B
- Implemented parsing and matching patterns in unicode mode
- Fixed capture results when iterating with nested capturing groups
- Significantly reduced regexp bytecode size
- Reduced stack usage during regexp execution
- Improved matching performance

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-05-26 15:28:54 +02:00
Péter Gál 908240ba62 Improve property key query for Proxy objects (#3797)
Property key query for Proxy objects always returned all keys
even if no symbols were requested symbols were present in the
resulting array.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-05-26 15:22:49 +02:00
Robert Fancsik dd6d148c3b Fix incorrect assertion in parser_parse_for_statement_start (#3795)
This patch fixes #3751.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-26 11:49:31 +02:00
Dániel Bátyai 15629e8ba5 Add stack limit check to proxy operations (#3796)
Fixes #3785.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-05-26 09:44:38 +02:00
Robert Fancsik 3060656562 Fix lazy property listing for [[Enumerate]] (#3794)
This patch fixes #3784.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-25 19:09:12 +02:00
Szilagyi Adam edaf4ef30f Rework the Reflect.preventExtensions method (#3771)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-25 18:25:09 +02:00
Szilagyi Adam 843c542053 Rework the Reflect.setPrototypeOf method (#3774)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-25 18:24:04 +02:00
Szilagyi Adam e50e2719df Get the typedArray's length property properly in Array.prototype.concat (#3791)
We should use the "length" property instead of the internal arraybuffer's length

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-25 18:10:38 +02:00
Szilagyi Adam ecf159795a Rework the Reflect.defineProperty method (#3770)
Also a minor update to the FromPropertyDescriptor operation since in ES6 we can use a property
descriptor whitout any keys

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-25 18:09:37 +02:00
Zoltan Herczeg 1105b43c22 Optimize Promise data structures. (#3768)
This patch reworks several structures:

- Fulfill and reject reactions are combined into one collection. The values in this collection
are compressed: a capability followed by an optional fulfill and reject functions.
- Fulfill and reject reactions are directly stored, no need to allocate an object for them.
- The job queue directly stores its items, this saves a pointer to the value, and the
callback is replaced by an uint8 type.
- Promise status and already resolved is stored in extra_info.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-25 18:00:43 +02:00
Péter Gál 1774cca47c Fix array length check in lastIndexOf (#3789)
When lastIndexOf is executed the array length can change and in
case of fast arrays the length should be re-checked.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-05-25 16:36:54 +02:00
Hyukwoo Park 589af6dc90 Handle properties of builtin routine separately from builtin objects (#3694)
separate builtin routine part to make code clear and to support 'name' property later

JerryScript-DCO-1.0-Signed-off-by: HyukWoo Park hyukwoo.park@samsung.com
2020-05-25 13:17:38 +02:00
Péter Gál 6fe6dab9cc Fix parseFloat input string length calculation (#3782)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-05-25 13:05:18 +02:00
Robert Fancsik b2a2022d0a Fix property order in lazy property listing for builtin/external functions (#3780)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-25 13:00:21 +02:00
Szilagyi Adam f06c533a29 Change the Reflect.ownKeys method's length property (#3775)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-25 12:59:51 +02:00
Robert Fancsik b9258da7d0 Accessor functions should not have 'prototype' property (#3781)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-25 12:57:25 +02:00
Robert Fancsik 6cd309b525 Function.prototype[@@hasInstance] should not throw error for not callable this value (#3773)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-22 17:23:07 +02:00
Rafal Walczyna 876622a061 Fix vera++ rule to find expressions without space after parentheses (#3776)
Regex didn't include some characters that may occur after ')'

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-05-22 14:37:59 +02:00
Rafal Walczyna 5d6069176b Change raw string length calculation method (#3772)
New method uses length of source to calculate raw string length.

Also bug with template literal was fixed. Template object should have
indexed properties enumerable.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-05-22 10:11:47 +02:00
Péter Gál 87b1d1eeb0 Fix regexp flag handling in case of regexp like object (#3766)
The regexp flag should be correctly referenced and released
if an existing regexp like object is used for constructing a new one.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-05-21 14:51:50 +02:00
Péter Gál 08222992dc Fix parseFloat for non-infinity values (#3769)
The parseFloat method performed the "Infinity" string check
incorrectly.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-05-21 14:50:59 +02:00
Szilagyi Adam e1960621f3 Add new target support to RegExp object (#3723)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-20 17:10:55 +02:00
Rafal Walczyna a4659a888b Add support of escaping backslash and backtick to String.raw (#3736)
Template literals already supports escaping backslash and backtick,
this commit enables escaping this in String.raw.
It also fixes invalid behaviour of String.raw when using
new line character.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-05-20 13:26:01 +02:00
Péter Gál bbb5c9180e Fix releasing the pattern string in regexp (#3765)
The release of the regexp pattern string during creating
was incorrect as it was dereferenced a bit to early.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-05-20 12:10:05 +02:00
Dániel Bátyai 378244942f Fix iterator closing in Promise all/race (#3759)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-05-18 21:22:08 +02:00
Dániel Bátyai 7274fa4dd4 Fix rounding in Number.prototype.toFixed (#3747)
Fixes #3741.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-05-18 18:39:00 +02:00
Csaba Osztrogonác f0d443daec Add --test262-es2015 option to run-tests.py (#3667)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-05-18 16:43:17 +02:00
Zoltan Herczeg e01cfda0b8 Check next token before reparsing identifiers in object assignments. (#3756)
Fixes #3735.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-18 13:16:16 +02:00
Zoltan Herczeg c4d5c2c9e1 There is no block info after invalid if-function construct. (#3755)
Fixes #3713.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-18 13:15:16 +02:00
Zoltan Herczeg 2570f8e745 Move an assertion after post processing. (#3754)
Fixes #3752.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-18 13:14:17 +02:00
Zoltan Herczeg 09ac2ffa67 Update obsolote assert. (#3752)
Fixes #3713.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-18 13:13:43 +02:00
Mátyás Mustoha 0aad9cb431 Add native AArch64 testing to Travis (#3729)
Adds support for building and running the test suite on Travis CI
using native AArch64 containers.

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2020-05-18 13:08:53 +02:00
Zoltan Herczeg bd1c4df9a6 Fix keyword parsing after use strict. (#3740)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-15 22:32:04 +02:00
Zoltan Herczeg 4aa27371b6 Array or object pattern must be assignment expression. (#3744)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-15 22:29:27 +02:00
Zoltan Herczeg 1f00d750b7 Implement parsing await. (#3738)
Several bugs fixed for parsing yield as well.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-15 22:26:05 +02:00
kisbg a6f6bce6f0 Added new target support for Date Object (#3739)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-05-15 22:21:40 +02:00
Mátyás Mustoha f13e8b602e Fix position calculations of String.startsWith (#3734)
Fixes two bugs in the index calculations that affect the result
of the `String.startsWith` function:

- Fixes the implementation of ECMA-262 v6, 21.1.3.18, step 14:
  "If searchLength+start is greater than len, return false".
- Fixes the return value of the helper function
  `ecma_builtin_helper_string_find_index`. If it is called with a
  starting search position, the returned index should be
  not less than that.

These changes fix the following test cases in the test262 suite:

- built-ins/String/prototype/startsWith/return-true-if-searchstring-is-empty.js
- built-ins/String/prototype/startsWith/searchstring-found-with-position.js

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2020-05-15 22:18:42 +02:00
Daniella Barsony b51157d3c5 Add Array new target support (#3728)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-05-15 16:36:06 +02:00
Szilagyi Adam 95aa827635 Fix value release in ecma_builtin_regexp_dispatch_helper (#3702)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-14 17:10:27 +02:00
Mátyás Mustoha aaf0442611 Improve AArch64 support (#3712)
- Adds a CMake toolchain file for AArch64 to help with cross compilation
- Tests the AArch64 build on Travis and runs the test suite using QEMU

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2020-05-13 14:56:30 +02:00
Robert Fancsik 9ad9d574fe Add proxy support for HasBinding operation for Object Environment records (#3731)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-13 14:27:31 +02:00
Zoltan Herczeg 4dc2cb3328 Implement proper creation of function arguments, let and const declarations. (#3725)
After the rework it is possible to detect use before init errors for function arguments.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-12 14:38:17 +02:00
Robert Fancsik df7e303145 Fix apply receiver operation for Proxy objects (#3730)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-11 16:56:41 +02:00
Szilagyi Adam 050fbfc130 Add Proxy support for JSON.stringify (#3685)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-11 15:18:18 +02:00
Szilagyi Adam 094ba2f30a Update the Array.prototype.reverse method to support ES6 version (#3676)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-11 13:42:46 +02:00
Szilagyi Adam 97a35b0f10 Add new target support to Function object (#3708)
Added steps 1, 2.c, 3.c, 21, 22 to ecma_op_create_dynamic_function

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-11 13:40:50 +02:00
Rafal Walczyna aa1777b1a0 Update ES6 Regexp accessors descriptors (#3726)
In ES6 accessors of built in object are by default configurable.
Also lastIndex property of RegExp object is created when only used.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-05-08 12:25:45 +02:00
Péter Gál 18fe546802 Fix appending elements for ecma collection (#3719)
During ecma_collection_append the underlying collection
was not increased in the required case. This triggered
a buffer overflow when processing the bound function's arguments
during call or during the Proxy ownKeys method.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-05-07 16:11:14 +02:00
Péter Gál 90c7eccb42 Fix fast array handling when doing put with receiver (#3720)
During "put" with receiver the fast arrays were not converted to normal
objects to correctly set properties on it.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-05-07 09:00:50 +02:00
Rafal Walczyna 99859fb221 Fix prototype of NativeError objects (#3716)
Internal property [[Prototype]] of EvalError, RangeError, ReferenceError,
SyntaxError, TypeError and URIError should be Error.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-05-07 08:58:42 +02:00
Mátyás Mustoha 5af751263b Remove the unused ecma_op_check_object_type_is_class declaration (#3718)
Removes the unused `ecma_op_check_object_type_is_class` function
declaration from `ecma-helpers.h`. This also makes the file pass
the Doxygen check.

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2020-05-07 08:56:31 +02:00
Daniella Barsony 8d08cec349 Update Travis build for OSx (#3721)
So far Travis doesn't support 10.15 (Catalina), but it does support a newer version (10.14, Mojave) than what we've been using (10.13, High Sierra).
This updates clang version too from 9.1.0 to 11.0.3.

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-05-06 14:01:03 +02:00
Szilagyi Adam 409e1fec5f Add missing index incrementation to ecma_builtin_string_object_raw (#3709)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-04 15:08:14 +02:00
kisbg 8ccb95c31c Added new target support to Promise (#3707)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-05-04 15:03:12 +02:00
Zoltan Herczeg 132a2008c9 Fix function argument handling issues caused by the parser. (#3705)
1) Nested function declarations should not overwrite arguments.
2) Functions should be created in the correct scope.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-05-04 14:55:46 +02:00
Robert Fancsik 40a9f27314 Fix __proto__ parsing in object literals (#3704)
Co-authored-by: Rafal Walczyna r.walczyna@samsung.com
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-05-04 14:49:15 +02:00
kisbg 14cea9c1ec Added new target support in Map, WeakMap, Set and WeakSet (#3701)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-05-04 14:24:39 +02:00
Szilagyi Adam b5d9699788 Update the RegExp.prototype.test function to support ES6 version (#3693)
The algorithm is based on ECMA-262 v6, 21.2.5.13

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-04 14:10:56 +02:00
Szilagyi Adam 1a72e070c8 Add value/key sign swap for Set.add and Map.set methods (#3681)
See also: ECMA-262 v6, 23.2.3.1 step 6 and 23.1.3.9 step 6

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-05-04 14:00:36 +02:00
Daniella Barsony 48e7b01fe9 Fix for OSx build (#3706)
Had an error on OSx when trying to build jerry, stating: "implicit conversion loses integer precision: 'cbc_opcopde_t' to 'uint16_t'"
Clang version: 11.0.3
OSx version: 10.15.4 (Catalina)

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-05-04 13:56:27 +02:00
Daniella Barsony 6ff299c831 Add [[GetOwnProperty]] internal Proxy method (#3672)
Depends on #3662

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-04-30 15:51:23 +02:00
Zoltan Herczeg 4b780507e1 Implement throwing const re-assignment error. (#3697)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-29 15:50:22 +02:00
Zoltan Herczeg 9e6c44be4f Fix function declaration issues inside catch blocks. (#3700)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-29 13:53:14 +02:00
Zoltan Herczeg 85401db547 Support function statements after 'if' or 'else'. (#3699)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-29 13:50:01 +02:00
Szilagyi Adam 2bdd0f5008 Accessor functions do not have [[Construct]] internal method (#3698)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-04-29 13:04:57 +02:00
Szilagyi Adam 62730f2ae1 Implement Proxy object [[DefineOwnProperty]] internal method (#3662)
The algorithm is based on ECMA-262 v6, 9.5.6

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-04-28 09:51:01 +02:00
Zoltan Herczeg f254b1a8b7 Fix invalid / unhandled this_literal cases. (#3696)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-27 14:54:21 +02:00
Zoltan Herczeg 4e8dac8ce1 Implement exponentiation operation. (#3692)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-27 11:43:35 +02:00
Zoltan Herczeg daeee77d63 Fix invalid assignment code generation. (#3695)
This patch prevents assigning a value to a string literal after a this token.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-27 10:14:29 +02:00
Zoltan Herczeg e2807c28fa Implement separate context for arguments. (#3686)
Fixes #3396.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-24 16:55:12 +02:00
Zoltan Herczeg dcf8ccfd03 Function declaration outside of blocks in direct eval must be ES5.1 compatible. (#3690)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-24 10:45:14 +02:00
Hyukwoo Park 1b1460e61f Fix attributes of length property for builtin functions (#3689)
fix length property of builtin functions to be configurable (ECMA-262 v6, 19.2.4.1)

JerryScript-DCO-1.0-Signed-off-by: HyukWoo Park hyukwoo.park@samsung.com
2020-04-22 08:36:23 +02:00
Rafal Walczyna bcd5ff3f40 Implement missing hyperbolic Math functions from ES6 (#3670)
Math.cosh, Math.sinh, Math.tanh

C implementation ported from fdlibm.

Part of Issue #3568

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-04-21 12:34:38 +02:00
Robert Fancsik d1bf9635c7 Fix incorrect assertion in parser_parse_for_statement_start (#3679)
This patch fixes #3655.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-04-21 12:00:39 +02:00
Zoltan Herczeg 3900152631 Fix delayed variable creation for function declarations. (#3687)
Fixes #3658.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-21 11:59:30 +02:00
Rafal Walczyna 0269b6c25d Fix is_constructor of bound function (#3684)
Bound function created from built-in function does not have a constructor

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-04-21 11:58:29 +02:00
Zoltan Herczeg 52f1476061 Fix assignment expression pre-scanning for arrow functions. (#3688)
Fixes #3656.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-21 11:25:36 +02:00
Robert Fancsik b209e95daa Fix iterator step calculation for bracketed property expressions (#3678)
This patch fixes #3665.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-04-20 19:32:59 +02:00
Rafal Walczyna 9c7a699d10 Implement missing Math Inverse Hyperbolic functions (#3675)
Math.acosh, Math.asinh, Math.acosh

C implementation ported from fdlibm

Part of Issue #3568

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-04-20 15:41:06 +02:00
Rafal Walczyna 453da11398 Implement missing Math.cbrt function from ES6 (#3680)
C implementation ported from fdlibm

Part of Issue #3568

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-04-20 15:40:03 +02:00
Zoltan Herczeg 1b01171a60 Update forcing of lexical environment creation for functions. (#3683)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-20 09:30:17 +02:00
Zoltan Herczeg 4be9ffda84 Use symbolic constants for code size checks. (#3682)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-17 13:05:07 +02:00
Daniella Barsony 895973ca82 Update device list in ReadMe (#3677)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-04-16 10:06:11 +02:00
Robert Fancsik 58257040dc Fix lexical binding set in VM_OC_COPY_TO_GLOBAL (#3653)
This patch fixes #3647.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-04-15 18:08:58 +02:00
Daniella Barsony e5702edab4 Update Babel ReadMe (#3673)
Remove Array.prototype.fill and Array.from from missing features that requires polyfill

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-04-15 16:53:14 +02:00
Robert Fancsik b5977de99c Fix lazy property name listing for ArrayIndices. (#3651)
This patch fixes #3648.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-04-15 15:21:06 +02:00
Szilagyi Adam d82bbb1c77 Update the isArray operation to handle proxy objects (#3666)
Added step 3. from ECMA-262 v6, 7.2.2

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-04-15 12:00:15 +02:00
Szilagyi Adam 4342c9ea6f Implement Proxy object [[OwnPropertyKeys]] internal method (#3639)
The algorithm is based on ECMA-262 v6, 9.5.12

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-04-14 16:57:47 +02:00
Robert Fancsik 60db840cf4 Fix super property assignment for namedaccessor properties (#3654)
Tha patch also updates the [[Put]] internal method with the new steps from the ES6 standard.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-04-09 17:08:08 +02:00
Szilagyi Adam 901e57c7d0 Implement Proxy object [[Construct]] internal method (#3657)
The algorithm is based on ECMA-262 v6, 9.5.14

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-04-06 12:17:23 +02:00
Dániel Bátyai 48fa2ec01b Fix the types of builtin prototype objects (#3663)
In ES2015 many builtin prototypes are no longer valid instances of their
respective classes. This change updates affected prototypes to be
regular objects as required.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-04-06 12:00:58 +02:00
Hyukwoo Park 73a78bd223 Fix attributes of length property for bound function (#3659)
fix length property of bound function objects to be configurable (ECMA-262 v6, 19.2.4.1)

JerryScript-DCO-1.0-Signed-off-by: HyukWoo Park hyukwoo.park@samsung.com
2020-04-04 02:04:02 +02:00
Rafal Walczyna e470b13096 Implement missing Math logarithm functions from ES6 (#3617)
Math.log2, Math.log10, Math.log1p, Math.expm1

C implementation ported from fdlibm

Part of Issue #3568

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-04-04 02:00:41 +02:00
Péter Gál c74256ccba Fix objects foreach unittest (#3660)
The `jerry_objects_foreach` unittest incorrectly
tried to create Map objects. Added extra checks
and improved the Map object creation.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-04-04 01:43:52 +02:00
Zoltan Herczeg 28f2772d9c Python debugger cleanup (#3635)
- Rename scopes to scope
- Make functions private
- Reorder some functions

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-04-02 17:57:23 +02:00
Csaba Osztrogonác 1bd1a36a81 Bump reference platform to Ubuntu 18.04 LTS (#3037)
Ubuntu 14.04 reached its end of life on April 30m 2019.
Let's bump the reference to the latest LTS, which is 18.04.

Ubuntu 18.04 has newer Pylint and Cppcheck, the necessary
fixes and suppresses are also included in this PR.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-03-30 12:26:56 +02:00
Péter Gál c237ba6097 Fix Array.slice when using fast arrays (#3649)
When a fast array was used during the Array.slice call and
the input array's properties were removed the property
list was used incorrectly.

Fixes: #3637

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-03-27 21:24:08 +01:00
Robert Fancsik d63936f371 CBC_PUSH_THIS should not be mutated in array literal parsing. (#3652)
This patch fixes #3650 and slightly reverts the changes of #3594.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-27 21:20:37 +01:00
Szilagyi Adam 4240b740aa Implement Object.prototype.__proto__ accessor property (#3546)
We are using the already existing Object.getPrototypeOf and
Object.setProtoypeOf methods

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-27 14:46:51 +01:00
Szilagyi Adam 94b8b4bb7b Implement Proxy object [[HasProperty]] internal method (#3642)
The algorithm is based on ECMA-262 v6, 9.5.7

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-27 14:33:56 +01:00
Robert Fancsik 3c7a776cae Fix heap-buffer-overflow in ecma_collection_append (#3645)
This patch fixes #3628.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-27 11:28:36 +01:00
Robert Fancsik 2ed742a9e7 Fix invalid free in ecma_op_function_get_super_constructor (#3644)
This patch fixes #3636.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-27 11:28:23 +01:00
Robert Fancsik 76b8555210 Remove JERRY_CONTEXT_INVALID_NEW_TARGET (#3643)
Until now JERRY_CONTEXT_INVALID_NEW_TARGET was used to represent whether the eval called from the script directly.
This information can be retrieved from the parser, so it simplifies the runtime handling of the new.target.

This patch fixes #3630, fixes #3640 and fixes #3641.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-27 11:21:50 +01:00
Virag Orkenyi 14bcc98089 Change the arguments list in ecma_builtin_array_reduce_from . (#3638)
This change deletes two routine arguments and creates an argument list in their place.

JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-03-27 11:20:25 +01:00
Péter Gál 43a36c9673 Fix VLA error in strings unittest (#3632)
In the test-api-string.c there was an error if the unittests are built in release.
Full error message:
```
tests/unit-core/test-api-strings.c:89:20: error: variable-length array bound is unknown [-Werror=vla-larger-than=]
89 |   JERRY_VLA (char, string_from_cesu8_string, cesu8_sz);
```

The problem is that the compiler does not know if the buffer size is always greater than zero.
Added an extra check to the TEST_ASSERT a line above to resolve the error.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-03-27 11:11:30 +01:00
Szilagyi Adam 6a022eb265 Implement Proxy object [[setPrototypeOf]] internal method (#3631)
The algorithm is based on ECMA-262 v6, 9.5.2

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-27 11:10:55 +01:00
Akos Kiss f29e6f9020 Fix undefined overflow behavior when converting double to integer (#3629)
Overflows in conversions from floating-point to integer are
undefined behavior in the C99 standard. (Clause 6.3.1.4: "If the
value of the integral part cannot be represented by the integer
type, the behavior is undefined.")

When UBSAN is enabled, this gets reported at `srand()` calls. (The
random seed is usually initialized using the date port API, which
represents dates as `double`s. But `srand` takes an `unsigned int`.
A simple cast from `double` to `unsigned` becomes undefined
behavior if the value is too large. And "now" is too large
nowadays. So, effectively, all executions start with an undefined
behavior.)

This patch fixes this by casting the floating-point value of the
date to an integer through a union.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2020-03-27 11:03:28 +01:00
Virag Orkenyi 18a4cba062 Implement Number.parseFloat and Number.parseInt (#3576)
The Global object parseFloat and parseInt fuctions have been moved to the number helpers and intrinsic properties have been created the are used for both the Number and Global methods.

JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-03-27 10:50:49 +01:00
Szilagyi Adam d539d30bf9 Update the RegExp constructor to ECMA-262 v6 (#3538)
The following methods have been implemented:
- RegExpAlloc, based on ECMA-262 v6, 21.2.3.2.1
- RegExpInitialize, based on ECMA-262 v6, 22.2.3.2.2
- RegExpCreate, based on ECMA-262 v6, 21.2.3.2.3

Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-27 10:37:06 +01:00
Szilagyi Adam 56832d772e Implement Proxy object [[getPrototypeOf]] internal method (#3623)
The algorithm is based on ECMA-262 v6, 9.5.1

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-26 14:22:12 +01:00
Péter Gál 655110ad7b Add a Proxy C unittest (#3633)
Previously only the Proxy api was tested.
Added a unittest to check the C callbacks via proxy.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-03-24 11:23:20 +01:00
Robert Fancsik 5b6d4f39b1 Add missing ecma_free_value to opfunc_init_class (#3626)
This patch fixes #3625.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-19 17:24:03 +01:00
Szilagyi Adam b2e54e915b Implement Proxy object [[Delete]] internal method (#3616)
The algorithm is based on ECMA-262 v6, 9.5.10

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-18 16:52:24 +01:00
Szilagyi Adam 85fced2632 Impelement Proxy object [[preventExtensions]] internal method (#3620)
The algorithm is based on ECMA-262 v6, 9.5.4

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-18 16:51:02 +01:00
Roland Takacs 51a9575fd0 Use array based storage in container objects (#3600)
Currently, collections use object based solutions for storing elements and
iterating on them. If an element is deleted and re-inserted, the storage
position is the same as before so the iteration order is wrong.
This patch replaces the object based storage with an array based solution
that helps to store and iterate elements as expected.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-03-17 19:30:55 +01:00
Zoltan Herczeg 1cfda262bd Catch paramter must not be scanned as function in ES5.1 (#3618)
Fixes #3554

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-17 13:06:59 +01:00
Szilagyi Adam 7ea93aff4c Fix assignment validation in parser_append_binary_token (#3594)
Fixes #3589

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-16 15:02:37 +01:00
Robert Fancsik c305aee80f Fix for-in/off block context initialization for empty destructuring patterns (#3614)
This patch fixes #3611.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-16 14:53:02 +01:00
Robert Fancsik 7f67795326 Spread operator should not update the scanner context's binding type (#3613)
This patch fixes #3595.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-16 14:52:05 +01:00
Szilagyi Adam bc7c39d893 Implement helper method for Proxy object internals (#3612)
This method generally does the steps 2-5 in the proxy internal methods

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-16 14:47:04 +01:00
Robert Fancsik 1a8276c493 Conditional expression should be parsed as AssignmentExpression (#3610)
This patch fixes #3553 and fixes #3608.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-16 14:44:39 +01:00
Robert Fancsik bfd2639634 Rework the core of class parsing/runtime semantic (#3598)
Changes:
 - Use the pre-scanner to provide information for the parser about the existence of the class constructor
 - The allocation of the super declarative environment is no longer needed
 - The VM frame context holds the information about the this binding status
 - Reduce the number of class related VM/CBC instructions
 - Improve ecma_op_function_{construct, call} to properly set new.target

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-16 14:37:47 +01:00
Szilagyi Adam 56b9f098ab Impement Proxy object [[isExtensible]] internal method (#3599)
The algorithm is based on ECMA-262 v6, 9.5.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-15 13:26:23 +01:00
Szilagyi Adam ccca998f43 Implement Proxy object [[Set]] internal method (#3605)
The algorithm is based on ECMA-262 v6, 9.5.9

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-14 20:06:27 +01:00
Hyukwoo Park 47d85a12e2 Fix attributes of length property for function objects (#3570)
fix length property of function objects to be configurable (ECMA-262 v6, 19.2.4.1)

JerryScript-DCO-1.0-Signed-off-by: HyukWoo Park hyukwoo.park@samsung.com
2020-03-12 15:00:53 +01:00
Robert Fancsik 6ef0a0e07e Fix the lazy listing of builtin property names (#3607)
This patch fixes #3606.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-12 12:45:53 +01:00
Zoltan Herczeg 57b8599581 Fix some style issues in the python debugger client. (#3603)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-03-11 16:01:12 +01:00
Daniella Barsony 055f753d02 Implement Proxy object [[Call]] internal method (#3609)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-03-11 15:38:16 +01:00
Szilagyi Adam 64fd37d1db Implement Proxy object [[Get]] internal method (#3604)
The algorithm is based on ECMA-262 v6, 9.5.8

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-11 15:34:46 +01:00
Rafal Walczyna 38862c39a6 Fix setting integrity level, when object has Symbol properties (#3602)
Symbol type properties were not included in SetIntegrityLevel operation

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-03-10 18:14:54 +01:00
Daniel Balla 9509c3da85 Add Map, Set, WeakMap, WeakSet basic functionality to the API (#3502)
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2020-03-10 18:10:56 +01:00
Csaba Osztrogonác 72f8ef344c Implement missing Math functions from ES6 standard (#3593)
First step to fix issue #3568.

Changes:
- Implemented Math.clz32(), Math.fround(), Math.imul(), Math.hypot().
- Implemented all remaining Math functions with calling the standard
libm functions, but they throw UNIMPLEMENTED exception with jerry-libm,
because the necessary fdlibm functions are missing and should be ported.

All Math related test262 tests pass (except function name and length tests)

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-03-10 11:15:00 +01:00
Hyukwoo Park 6c3a42ec48 Add es5.1 specific directory in jerry-test-suite (#3567)
since compatibility issues between es5.1 and es6 exist,
es5.1 specific directory is newly added which includes es5.1 specific test.

JerryScript-DCO-1.0-Signed-off-by: HyukWoo Park hyukwoo.park@samsung.com
2020-03-06 14:17:05 +01:00
Szilagyi Adam 651b62584a Use stringbuilder in jerry_debugger_exception_object_to_string (#3586)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-04 18:06:40 +01:00
Szilagyi Adam 23974e2389 Use stringbuilder in ecma_raise_standard_error_with_format (#3585)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-04 18:05:08 +01:00
Szilagyi Adam 76bbb088e9 Optimize Array.prototype.fill for fast-array cases (#3569)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-03 15:48:50 +01:00
Rafal Walczyna 3c8a6ca71d Fix error for duplicated names in ArrowFunction paremeter list (#3597)
Duplicated parameter names are not allowed for arrow functions
regardless of strict mode.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-03-03 09:18:27 +01:00
Hyukwoo Park 34edf53753 Add new type which represents pointer with tag value (#3591)
jmem_cpointer_tag_t is newly added to represent pointer along with tag value.
This new type is first applied to scope_cp to mark initailized function properties (length, name) later

JerryScript-DCO-1.0-Signed-off-by: HyukWoo Park hyukwoo.park@samsung.com
2020-03-02 15:59:55 +01:00
Roland Takacs 19c61e14c0 Fix float point number comparsion (#3596)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-03-02 15:57:11 +01:00
Szilagyi Adam aa17a4fa5d Implement ecma_stringbuilder_create_raw method for stringbuilder (#3584)
With this new method, we can create a stringbuilder from a raw string

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-02 15:39:12 +01:00
Robert Fancsik ec39d08d67 Fix object destructuring for empty pattern (#3571)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-03-02 15:37:03 +01:00
Péter Gál f31931267a Fix argument flags when invoking native function via construct (#3590)
When calling a native function via construct it should not have any
flags in the argument list pointer.

Fixes: #3588

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-03-02 10:37:41 +01:00
Szilagyi Adam a6acf2d417 Fix value release in ecma_builtin_array_prototype_object_copy_within (#3583)
Fixes #3580

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-03-02 10:28:02 +01:00
Robert Fancsik 4e136c8973 Implement the core of Proxy object (#3562)
- Internal routines of the of the proxy object are unimplemented
 - For-in enumerate with proxy target is currently not supported

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-02-28 14:41:59 +01:00
Robert Fancsik 9b393ee2ea Remove ECMA_OBJECT_TYPE_ARROW (#3582)
Until now arrow functions had a separate type, but most of the time they can be handled similar to single functions.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-02-25 13:28:50 +01:00
Rafal Walczyna 20300189cb Fix Symbol properties descriptors. (#3581)
Symbol properites descriptors had invalid values

Fixes #3578

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-02-24 14:06:14 +01:00
Szilagyi Adam 6430d1a3a3 Use stringbuilder in static_snapshot_error_unsupported_literal (#3574)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-24 11:34:07 +01:00
Zoltan Herczeg bd2696f7c7 Add global status flags for the parser. (#3572)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-02-24 11:22:20 +01:00
Szilagyi Adam cdbabc8c30 Use stringbuilder in ecma_builtin_try_to_instantiate_property (#3575)
Also removed the ecma_append_magic_string_to_string method,
because it doesn't get used anymore.

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-24 11:19:04 +01:00
Szilagyi Adam acbdb4184f Use stringbuilder in ecma_builtin_typedarray_prototype_join (#3573)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-24 11:15:36 +01:00
Daniella Barsony 73daeb19c9 Implement new Reflect methods (#3549)
This patch implements the get, set, has, deleteProperty, ownKeys, and construct methods of the Reflect objects. The Reflect.construct method is missing the new_target support because ecma_op_function_construct doesn't support it yet.

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-02-24 11:02:06 +01:00
Dániel Bátyai 68909fc5de Fix lexical scoping between scripts (#3558)
This change fixes the handling of lexical blocks when executing multiple
scripts, and also fixes a few issues with module environments.

After this change, all script files will run in the same context and
will have access to lexically scoped global variables of previous
scripts, and module environments will no longer have a bound global
'this' value.

The REPL implementation in main-unix is also fixed to correctly handle
lexically scoped variables.

Fixes #3561.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-02-21 13:30:48 +01:00
Szilagyi Adam b0a575b049 Use stringbuilder in vm_get_backtrace (#3566)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-20 13:01:04 +01:00
Szilagyi Adam f8da3d5e9d Remove vm_init_loop (#3551)
For every bytecode in the above function, i created a new VM_OC group code
to be able to execute them in the vm_loop. With this update, the expectation
is a faster runtime.

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-19 16:49:35 +01:00
rwalczyna 98b90ba697 Fix third parameter of forEach callback function in Map and Set (#3565)
There was a problem with passing third parameter to callback.

This patch fixes #3564

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-02-18 19:22:08 +01:00
rwalczyna 0ff664cab6 Fix Array.find and Array.findIndex omitting empty values. (#3563)
Empty values in array were omitted. Predicate should be called
for every element from 0 to length.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-02-18 15:19:53 +01:00
Szilagyi Adam 181570ff41 Implement EscapeRegExpPattern method (#3543)
the algorithm is based on ECMA-262 v6, 21.2.3.2.4

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-18 09:49:54 +01:00
Zoltan Herczeg fda02d4b2a Fix local scoping for functions. (#3559)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-02-18 09:49:03 +01:00
Szilagyi Adam 44e63e038d Use stringbuilder in ecma_get_symbol_descriptive_string (#3560)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-18 09:47:53 +01:00
Hyukwoo Park 54e4de39ab Fix attributes of length property for builtin objects (#3556)
* length property has the attributes {[[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true} based on ECMA-262 v6, 19.2.4.1

JerryScript-DCO-1.0-Signed-off-by: HyukWoo Park hyukwoo.park@samsung.com
2020-02-14 10:25:26 +01:00
Szilagyi Adam 4d67ac3225 Use stringbuilder in ecma_builtin_string_prototype_object_concat (#3557)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-13 17:42:07 +01:00
Zoltan Herczeg 4b325ea9e3 Rework map_to member of the scope chain that it can store flags. (#3552)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-02-13 17:39:56 +01:00
Szilagyi Adam 8cd5d06620 Update ecma_op_typedarray_from to use iterable objects (#3501)
Added steps 6-8 from ECMA-262 v6, 22.2.2.1.1

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-02-13 15:53:41 +01:00
Robert Fancsik 5fdeb7c1d6 [[Prototype]] object's reference count should be increased by jerry_get_prototype (#3550)
This patch ensures that the implementation satisfies the requirements of the public API documentation.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-02-07 18:20:39 +01:00
Dániel Bátyai d7404700ad Update API version to 2.2.0 (#3547)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-02-07 15:38:49 +01:00
Paul Sokolovsky b044d4ad76 jerry_init: Calculate structure part address more safely. (#3545)
GCC 9.2 issues a warning-as-error trying to perform a large memset into
what it thinks as a single field of a structure. So, instead of taking
an address of that field, perform explicit address calculaton using
structure address and offset of that field.

Fixes #3544.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2020-02-06 14:18:19 +01:00
Péter Gál 0d7f26e2c4 Add a few missing api version documentation (#3542)
A few api method/struct documentation did not have the
entry describing in which version it was introduced.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-02-04 13:17:24 +01:00
Péter Gál fa81944743 Foreach API methods should not iterate over internal objects (#3537)
The `jerry_objects_foreach` and `jerry_objects_foreach_by_native_info` methods
iterates over all objects. However in ES 2015 there are a few special objects
which should only be used internally thus these objects should not be accessed
by the API user.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-02-03 19:07:24 +01:00
Dániel Bátyai a78c8d4f16 Add vera rules to check consecutive and trailing empty lines (#3540)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2020-02-03 16:39:04 +01:00
Robert Fancsik 563a5d93e9 Fix 'arguments' and 'caller' properties lazy listing in ES2015 profile (#3539)
This patch fixes #3536.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-02-03 15:12:59 +01:00
Robert Fancsik 7734f87fbb For in-of declaration should only throw error after initialization. (#3541)
This patch fixes the error introduced in #3513.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-02-03 15:12:12 +01:00
Szilagyi Adam 2fe06f82f1 Add strict mode check to for-in and for-of header in parser_parse_for_statement_start (#3513)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-01-28 13:24:30 +01:00
Robert Fancsik b73100d933 Add missing release value call to Array.prototype.pop fast path. (#3535)
This patch fixes #3534.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-24 10:54:55 +01:00
Robert Fancsik e693854dae Fix array-indexed property name calculation for fast access mode arrays in property name listing (#3533)
This patch fixes #3532.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-23 17:21:35 +01:00
Robert Fancsik 3c5fb342be Update "arguments" and "caller" properties of function object to conform ES6 changes (#3530)
This patch resolves #3393.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-23 15:53:37 +01:00
Csaba Osztrogonác b7a2a153aa Fix the build with enabled debugger on Windows (#3531)
Changes:
- Typo fixed in cmake build system and appveyor config
- Added a new buildoption test

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-01-23 15:30:09 +01:00
Péter Gál 608bc9e5ff Improve new.target handling in case of eval calls (#3517)
Only direct eval calls propagate the "new.target" information.
In any other eval cases the "new.target" invocation is a syntax error.

Added test cases also.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-01-21 18:01:35 +01:00
Robert Fancsik 05b4bda927 Colon must be expected after computed property name in object destructuring (#3529)
This patch fixes #3527.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-20 16:49:08 +01:00
Péter Gál 24af089643 Introduce new.target C api (#3522)
Added new "jerry_get_new_target" API function
and updated the unit test.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-01-18 10:58:33 +01:00
Daniel Balla f46d061d19 Allow API usage in native_free_callbacks (#3515)
This patch allows the use of API functions in native_free_callbacks for native pointers once again.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2020-01-18 10:05:32 +01:00
Robert Fancsik 71d4e12105 Fix assignment opcode transformation for CBC_PUSH_THIS_LITERAL (#3525)
This patch fixes #3477.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-17 11:37:10 +01:00
Robert Fancsik c4948936c2 Add missing release value to ecma_op_object_get_property_names (#3524)
This patch fixes #3523.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-17 11:36:40 +01:00
Zoltan Herczeg f3d49f65dd Always mark the identifers which are propagated to upper level after argument parsing. (#3516)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-16 17:01:56 +01:00
Zoltan Herczeg 22eabd0e0b Allow an extra comma before the end of a function call. (#3520)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-16 17:00:49 +01:00
Péter Gál daf3b36ea6 Fix new.target invalidity check (#3521)
Fixes #3519

Only check the assert if the new.target bytecode is detected.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-01-16 16:03:59 +01:00
Peter Marki 51244b6d08 Add option to list symbols in Object.getOwnPropertyNames() (#3507)
Also a little refactoring of Object.getOwnPropertyNames()

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2020-01-16 15:59:27 +01:00
Robert Fancsik 8b41bf306a Introduce builtin intrinsic object to share property values between builtin objects (#3490)
Fixed:
 - Global symbol access
 - Array.prototype.values and Array.prototype[Symbol.iterator] must be the same function object

To test the new functionality arguments object Symbol.iterator property is added.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-16 15:57:27 +01:00
Daniel Balla 332e216736 Add runtime option "--call-on-exit [FUNCNAME]" to main-unix.c (#3518)
With this option you can call a function after the user script and promises have ran, to be able to do assertions that are executed just before the process would exit.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2020-01-15 17:10:42 +01:00
Robert Fancsik 4a331b2edc Add builtin GeneratorFunction support (#3499)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-15 12:01:58 +01:00
Csaba Osztrogonác e3decffdd3 Make run-test-suite.py handle crashes properly (#3512)
Changes:
- Crashing jerry / jerry-snapshot is always "FAIL",
only the 1 return code is accepted as expected fail.
- "FAIL (XPASS)" string is only used if the test marked
as expected fail, but the return code is 0.
- Simple "FAIL" string is used if the test marked as expected
fail, but the return code is not 0 or 1. (crash)

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-01-15 09:14:51 +01:00
Robert Fancsik 210b631b21 Fix iterator position calculation for array patterns (#3494)
This patch fixes #3455.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-14 16:03:26 +01:00
Peter Marki c8ce7d8791 Construct non-fast array in ecma_op_array_species_create (#3514)
Fixes #3506

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2020-01-14 15:35:49 +01:00
Zoltan Herczeg 0d7b461185 Correctly handle celestial plane codepoints in ES5.1. (#3510)
Fixes #3498.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-14 15:11:59 +01:00
Zoltan Herczeg d6070a9fed Call filter arguments after the global arguments are parsed. (#3511)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-14 15:10:19 +01:00
Péter Gál 0fd1ed6f27 Add support for new.target (#3469)
Notable changes:
* Extracted the pure JS/builtin and external C method invocations
  into two new methods (`ecma_op_function_call_{simple, external}`).
* Updated parser/scanner to handle "new.target" correctly.
* Added JS test case.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2020-01-14 13:34:19 +01:00
Robert Fancsik be8ae3aae8 Add iterator close support for for-of statement (#3401)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-13 17:38:47 +01:00
Zoltan Herczeg f1dd59e4bd Property modifiers should not be checked before an equals. (#3509)
Fixes #3434.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-13 15:14:29 +01:00
Zoltan Herczeg 9a8160176c Nested destructuring binding patterns should inherit the PARSER_PATTERN_ARGUMENTS flag. (#3508)
Fixes #3398.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-13 15:13:57 +01:00
Robert Fancsik be83ff6b71 Update Function.prototype.bind to conform ES6 requirements (#3504)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-13 11:43:11 +01:00
Robert Fancsik d0e8629342 Support nested destructuring patterns in catch header (#3488)
This patch fixes #3433.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-13 11:39:07 +01:00
Daniel Balla 1725e014b8 Support iterable objects in Promise.all and Promise.race functions (#3496)
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2020-01-10 15:44:52 +01:00
Szilagyi Adam c407e8a04c Refactor ecma_builtin_error_prototype_object_to_string to use stringbuilder (#3503)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-01-10 15:40:00 +01:00
Virag Orkenyi b6c2e6eb54 toNumber operation should handle binary and octal literals (#3471)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-01-10 15:31:54 +01:00
Robert Fancsik b3b1dfdabd Tagged template object references should be released only in post_processing (#3495)
This patch fixes #3483.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-10 15:25:40 +01:00
László Langó 2960dffb50 Support all literals in 'jerry_get_literals_from_snapshot' when C format is used. (#3472)
The literals must be saved in hex format to support cases with special
characters, like `var s = 'hello",\n"world';`

JerryScript-DCO-1.0-Signed-off-by: László Langó lango@inf.u-szeged.hu
2020-01-10 14:57:10 +01:00
Peter Marki 08da8bc7aa Add length check to ecma_builtin_array_prototype_object_slice (#3481)
Fixes #3479

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2020-01-10 12:16:53 +01:00
Robert Fancsik dc3de8d8ae Fix for-of block context creation for empty destructuring pattern (#3492)
This patch fixes #3421.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-08 14:55:02 +01:00
Szilagyi Adam aedd55b1f8 Add unscopables check to ecma_op_get_value_lex_env_base (#3476)
Also added a special test case for this to symbol-unscopables.js

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-01-07 15:13:28 +01:00
Robert Fancsik 003694d259 Throw error for generator function class constructor (#3489)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-01-07 14:52:01 +01:00
Szilagyi Adam 22e52e45af Fix value release in ecma_builtin_typedarray_prototype_map (#3491)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-01-07 14:25:59 +01:00
Roland Takacs 420643d645 Use Python 3.6 in case of Zephyr target (#3493)
PyYAML requires Python 2.7 or Python 3.4+.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs r.takacs2@partner.samsung.com
2020-01-07 12:53:53 +01:00
Csaba Osztrogonác 9e0709e401 Fix Array.prototype.reduce and reduceRight (#3487)
Don't throw TypeError when object length is 0 and initialValue is undefined.
Additionally the error message should be more precise and match other engines.

Fixes #3463

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-01-06 15:17:54 +01:00
Szilagyi Adam 40b38f70ef Refactor ecma_regexp_exec_helper arguments (#3484)
We use pointers instead of ecma_value_t

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-01-06 14:38:09 +01:00
Szilagyi Adam 183600dff2 Refactor ecma_op_same_value (#3486)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-01-06 14:33:46 +01:00
Zoltan Herczeg fa2ddb2466 Create a new file for scanner operations. (#3475)
Compared to utils, the functions here scan the input (e.g. uses lexer_next_token).

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-06 11:05:39 +01:00
Peter Marki 300570381f Add fast-path check to ecma_builtin_array_prototype_slice (#3480)
Fixes #3459

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2020-01-06 10:30:10 +01:00
Zoltan Herczeg dc15944ebd Remove lexer_process_char_literal function. (#3474)
Add a test for using large literals.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-01-06 10:13:05 +01:00
Daniel Balla e21e4a18ba Fix freeing this_arg in ecma_builtin_promise_race_or_all (#3482)
Fixes #3478

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2020-01-03 14:18:40 +01:00
Csaba Osztrogonác 518fcf2c6a Optimize ecma_number_to_uint32 (#3470)
The ecma_number_to_uint32 function is called many times, we can merge
ecma_number_is_nan and ecma_number_is_infinity checks to !ecma_number_is_finite
to let the compiler generate more optimal code for it.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-12-20 12:37:02 +01:00
Zoltan Herczeg 8cb2be6001 Support parsing async modifiers for functions. (#3460)
Only parsing is implemented, so the async functions currently behave
like normal function except they return with a resolved Promise object
when the function is terminated correctly.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-20 09:55:41 +01:00
Dániel Bátyai 2a29b72a83 Implement and add support for Symbol.split (#3453)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-12-20 09:10:58 +01:00
Csaba Osztrogonác 85bb2113fe Make Math.min() and Math.max() ECMA262 conform (#3465)
Math.min() and Math.max() functions should apply ToNumber on each arguments
always, even if a NaN argument occured previously and the result will be NaN.

ECMA262 v5.1 15.8.2:
"Each of the following Math object functions applies the ToNumber abstract
operator to each of its arguments (in left-to-right order if there is more
than one) and then performs a computation on the resulting Number value(s).

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-12-20 08:57:17 +01:00
Robert Fancsik ea5ad2a06f Fix the parsing/scanning of empty return statement (#3468)
This patch fixes #3467.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-19 19:31:59 +01:00
Robert Fancsik 9596a7e1d6 Implement tagged template literals (#3456)
Missing features: snapshot support

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-19 19:10:45 +01:00
Szilagyi Adam 7bfbc701d8 Implement Symbol.unscopables (#3405)
Added a new property for Array.prototype based on ECMA-262 v6, 22.1.3.31
Also upgraded the HasBinding operation with ECMA-262 v6, 8.1.1.2.1 steps 7-9

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-12-19 16:34:23 +01:00
Daniel Balla 52616f7d8c Early return when the scanner throws an error while parsing an invalid function identifier (#3464)
Fixes #3454

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-12-19 15:50:09 +01:00
Csaba Osztrogonác 456fb046ba Remove asserts from ecma_number_is_zero and is_inf (#3466)
There is no reason to force the developer to call ecma_number_is_nan
check before all ecma_number_is_zero and ecma_number_is_infinity.
These functions work fine and return false if NaN is passed.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-12-19 15:36:56 +01:00
Péter Gál d27a07edf4 Add missing assert entry in case of static super assignment (#3462)
In case of static super member assignments there was a missing
check to validate if the CBC opcode is of CBC_EXT_PUSH_STATIC_SUPER.

Fixes: #3458

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-12-19 12:38:38 +01:00
Szilagyi Adam e2893f26a1 Add iterator closing for ecma_op_container_create (#3457)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-12-19 11:40:29 +01:00
Zoltan Herczeg d0b4e7dd04 Free three parser status flag bits. (#3451)
The operations covered by these bits can be done in a different way.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-17 11:43:37 +01:00
László Langó 0428b51e35 Uncomment some fixed test cases (#3452)
After #3440 the Symbol related test cases runs fine for
Arrays, so the TODO had been resolved in that particular
test file.

JerryScript-DCO-1.0-Signed-off-by: László Langó lango@inf.u-szeged.hu
2019-12-17 11:42:56 +01:00
Szilagyi Adam b6f2ff1ba7 Implement binary literal parsing (#3439)
This patch will allow the user to use binary literals starting with 0b or 0B,
these literals will be evaluated in parsing time resulting an integer

Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-12-17 11:42:29 +01:00
Zoltan Herczeg 3c0beaf87d Support strict mode detection in the pre-scanner. (#3450)
Furthermode an error is thrown when 'use strict' is used in a function with non-simple arguments
and function arguments are not moved to lexical environment when unmapped arguments are present.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-17 10:59:03 +01:00
Zoltan Herczeg b1237dbc5a Detect keyword type even if the keyword is identifier. (#3448)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-16 13:36:26 +01:00
Daniel Balla e0d8c4ca10 Add @@species accessor to Array and Promise builtin objects (#3440)
Fully support @@species and SpeciesConstructor in Array and Promise builtins.
Also added partial support to TypedArrays, but a rework is needed in %TypedArray%.prototype functions' typedarray constructor, which is out of this patch's scope.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-12-16 11:44:15 +01:00
Zoltan Herczeg 40d930d62c Implement \u{hex} support. (#3447)
A large rework because surrogate pairs must be combined.

Currently only the 0x10C80..0x10CF2 is accepted as valid identifier character from the non-basic plane.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-16 11:26:02 +01:00
Csaba Osztrogonác 1db16c3a1c Fix Math.round(x) for big integer numbers (#3449)
Math.round(x) should be x it x is already integer. (ES5 15.8.2.15)
The current implementation calculates with x +/- 0.5, which isn't
representable numbers if x >= 2^52.

A correct bug fix can be to follow the spec and simply
return the number itself if it is already integer.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-12-16 10:57:22 +01:00
Dániel Bátyai d3b8bed2c1 Implement and add support for RegExp.prototype[@@search] (#3436)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-12-12 15:59:28 +01:00
László Langó c525b1f10a Fixed segmentation fault in scanner. (#3444)
The register end index was not correctly calculated when
only holes presented in the arguments list of a function.

Fixes #3419, fixes #3431

JerryScript-DCO-1.0-Signed-off-by: László Langó lango@inf.u-szeged.hu
2019-12-12 12:17:45 +01:00
Csaba Osztrogonác fb4b18a515 Fix Math.trunc(x) if -1 < x < 0 (#3445)
Math.trunc(x) should be -0.0 if -1 < x < 0 (ES2015 20.2.2.35). The problem
was that -0 isn't -0.0, but +0.0 in C. There were a test case for it, but
it was incorrect, because +0.0 === -0.0 in JS.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-12-12 10:57:44 +01:00
László Langó df6995d0f6 Fixed typos in filenames of regression tests. (#3443)
JerryScript-DCO-1.0-Signed-off-by: László Langó lango@inf.u-szeged.hu
2019-12-11 16:19:05 +01:00
László Langó 4b5fad748f Fixed memory leak in rest initializer. (#3438)
Fixes #3437

JerryScript-DCO-1.0-Signed-off-by: László Langó lango@inf.u-szeged.hu
2019-12-11 10:24:49 +01:00
Robert Sipka f7382ce8c4 Updated the supported Unicode version from 9.0.0 to 13.0.0 (#3435)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2019-12-10 20:31:04 +01:00
Robert Fancsik 9b33fc8cbd Revise the usage of the global error value/exception flag (#3426)
This patch also fixes #3422.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-10 14:42:10 +01:00
Szilagyi Adam 7c0b1ca88a Update String.prototype.match to ECMA-262 v6 (#3375)
The algorithm is based on ECMA-262 v6, 21.1.3.11

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-12-10 14:40:41 +01:00
Zoltan Herczeg 531f1e9687 Support let identifier in non-strict mode. (#3427)
This code adds a lot of checks and complexity to the code.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-10 14:32:08 +01:00
Szilagyi Adam 6cc9848afc Implement Array.of method (#3418)
The algorithm is based on ECMA-262 v6, 22.1.2.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-12-10 14:30:59 +01:00
Zoltan Herczeg b8bc013fc0 Keywords must not contain escape sequences. (#3429)
The ES5.1 standard is unclear about this rule.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-09 14:37:41 +01:00
Szilagyi Adam dc458d29fb Implement TypedArray.of method (#3428)
The algorithm is based on ECMA-262 v6, 22.2.2.2

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-12-09 14:19:40 +01:00
Daniella Barsony 89db9253c8 Refactor code to use ToInteger (#3224)
Fixes #3325
Fixes #3237

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-12-09 12:07:25 +01:00
Zoltan Herczeg 5ceffd209e Fix post increase / decrease in the pre-scanner. (#3430)
Fixes #3397.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-06 13:53:34 +01:00
Szilagyi Adam e70cfed57a Add bounds check for copyWithin (#3425)
When inputs are out of bounds, we don't need to do anything in the operation.

Fixes #3408

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-12-06 13:33:41 +01:00
Robert Fancsik 99fa823bab Fix cleanup on error in Array.from (#3423)
This patch fixes #3420.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-05 20:24:37 +01:00
Zoltan Herczeg 1a4972fc3f Implement yield* operation in generator functions. (#3407)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-05 13:50:53 +01:00
Robert Fancsik 1829d2df55 Fix scanner_create_variables for empty destructuring patterns (#3417)
This patch fixes #3383.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-04 15:38:50 +01:00
Roland Takacs 67d677a1bc Implement ArrayBuffer.isView function (#3403)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs r.takacs2@partner.samsung.com
2019-12-04 15:36:42 +01:00
Robert Fancsik 59eb0787ba Fix global error management in ecma_builtin_string_prototype_object_split (#3414)
This patch fixes #3395.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-04 14:13:43 +01:00
Robert Fancsik e188407d3a Support spreaded argument list in super property reference. (#3415)
This patch fixes #3394.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-04 14:13:00 +01:00
Robert Fancsik 99ae94b7c0 ecma_create_error_reference should clear the context's exception flag. (#3413)
This patch fixes #3410.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-04 14:12:06 +01:00
Robert Fancsik 041df1ec3c Fix the global error management on promise operations (#3412)
This patch fixes #3409 and fixes #3411.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-04 12:51:52 +01:00
Szilagyi Adam 4443c88bf4 Fix index handling in ecma_op_advance_string_index (#3406)
Fixes #3389

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-12-04 11:14:25 +01:00
Robert Fancsik bfc495f0cb Implement Array.from routine (#3402)
The patch also revealed a minor issue about Map[Symbol.iterator] which have been fixed as well.

Co-authored-by: Daniella Barsony bella@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-03 15:39:11 +01:00
Csaba Osztrogonác d31871d7c9 heap-buffer-overflow in ecma_date_parse_year (#3404)
If ecma_date_parse_year got an invalid date string, it could overread the input string.
The problem was that we compared the original str_p to str_end_p instead of str_start_p.
Additionally I simplified the parser loop.

Fixes #3388.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-12-03 13:42:39 +01:00
Zoltan Herczeg 31988877b2 Support destructuring bindings as catch variables. (#3399)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-03 12:52:20 +01:00
Dániel Bátyai 9634ca556e Fix leaking char buffer in RegExp.prototype[@@replace] (#3400)
Fixes #3392.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-12-03 09:34:53 +01:00
Robert Fancsik cc03c08c3d Fix error handling in abrupt promise rejection (#3391)
This patch fixes #3390.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-12-03 09:34:38 +01:00
Szilagyi Adam bdc608f2fb Optimize array copyWithin for fast-array cases (#3295)
Performance results:
Intel: 0m9,7s -> 0m0,07s
ARM: over 10m -> 1m38s

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-12-02 16:12:17 +01:00
Zoltan Herczeg 132de45c0b Remove CBC_EXT_CONTINUE_EXEC opcode. (#3378)
There is no need for a specific opcode after yield because
the return and throw commands can be redirected to fake byte code sequences.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-12-02 12:37:13 +01:00
Csaba Osztrogonác 51efba40b4 Remove dead code from ecma_date_parse_year() (#3387)
Code cleanup after #3314. Reverting already parsed '-' sign
after parse fail is unnecessary, because in this case the whole
date parse is failed.

Additionally this dead code was incorrect too, because it didn't
modify the original pointer to the string, but a local variable.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-29 20:54:57 +01:00
Robert Fancsik 0bc42a3fd5 Allow lexical function declaration in labeled statements. (#3386)
This patch fixes #3381.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-29 16:41:21 +01:00
Zoltan Herczeg fee3a600af Support assignment expressions in the pre-scanner. (#3382)
Fixes #3355.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-29 15:47:47 +01:00
Robert Fancsik 42b4af5921 Fix exception handling in ecma_op_create_promise_object (#3385)
This patch fixes #3376.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-29 15:45:41 +01:00
Csaba Osztrogonác 336fa45fa7 Make REPL option parser handle "-" option properly (#3384)
REPL could read JS file from standard input when we passed "-" option,
but after #1896 "-" became invalid option mistakenly.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-29 14:52:54 +01:00
Roland Takacs c5ed46f5ac Allow to create ArrayBuffer with empty external user data (#3373)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs r.takacs2@partner.samsung.com
2019-11-29 14:22:44 +01:00
Dániel Bátyai 35c0a6e299 Implement RegExp unicode and sticky flags (#3379)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-29 14:08:30 +01:00
Zoltan Herczeg 8956eff2bd Implement generator support for object initializers and classes. (#3372)
Large part of the code is also reworked.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-29 12:28:51 +01:00
Zoltan Herczeg 1b01bb034f Change JERRY_ES2015_BUILTIN to JERRY_ES2015. (#3377)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-29 11:17:15 +01:00
Zoltan Herczeg f41afeb89f Change JERRY_ES2015_BUILTIN_ITERATOR macro to JERRY_ES2015. (#3374)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-28 14:44:55 +01:00
Zoltan Herczeg 110f75c99d Implement the core of the generator functions. (#3368)
Some things are missing:
 - yield* support
 - generator definition in object literal
 - the hidden GeneratorFunction

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-28 11:54:27 +01:00
Robert Fancsik 14e95a4775 Fix the handling of unresolvable reference in VM_OC_TYPEOF_IDENT (#3371)
This patch fixes #3363.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-27 22:27:34 +01:00
Szilagyi Adam b7508c636c Fix value release in ecma_op_is_concat_spreadable (#3346)
Fixes #3356
Fixes #3361

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-27 11:06:51 +01:00
Szilagyi Adam 0c6b306429 Implement Regexp.prototype[@@match] method (#3345)
The algorithm is based on ECMA-262 v6, 21.2.5.6

The following helper methods are also implemented:
  - RegExpExec: ECMA-262 v6, 21.2.5.2.1
  - AdvanceStringIndex: ECMA-262 v6, 21.2.5.2.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-26 16:05:48 +01:00
Zoltan Herczeg 9725936848 Rework register reference in the vm. (#3370)
The aim is storing only ecma values on the vm stack.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-26 16:03:20 +01:00
Robert Fancsik cbeecdb703 Fix this property reference on assignment patterns (#3365)
This patch fixes #3348.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-26 15:49:55 +01:00
Robert Fancsik 12211d8aaa Fix the order of the function arguments for spread operation (#3369)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-26 15:47:36 +01:00
Robert Fancsik aeb8431aff Fix the scanning of default array/object literals. (#3367)
Scanning should continue with `SCAN_MODE_POST_PRIMARY_EXPRESSION` in all cases.

Fixes #3360.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-26 13:07:28 +01:00
Robert Fancsik f63e4c363b Fix the assertion for VM_OC_EVAL. (#3366)
Eval flag can be set for spreaded argument function calls as well.

This patch fixes #3364.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-26 13:05:56 +01:00
Csaba Osztrogonác 4d422e17df Make Date.parse() ECMA-262 conform (#3314)
Changes:
- Parse output of Date.prototype.toString() and Date.prototype.toUTCString()
- Date.prototype.toString() is ECMA-262 v9 conform now, only TZ part changed
  (Before ECMA-262 v9 it was implementation-dependent.)
- Reused day_names_p and month_names_p arrays (and made them more efficient)
- Tests updated and new tests added

Fixes #2946.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-26 13:04:11 +01:00
Dániel Bátyai 16d0e83b64 Fix adding fast arrays as keys to a weak container (#3362)
Fixes #3359.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-26 08:21:33 +01:00
Csaba Osztrogonác 2e8a8f5caa Fix the es2015-subset profile build on Windows (#3347)
JERRY_ATTR_NOINLINE define is __declspec(noinline) which should be placed
at the beginning of the declaration and caused build fail because it was
placed after the * character. Details can be found here:
https://docs.microsoft.com/en-us/cpp/cpp/declspec?view=vs-2019

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-25 11:49:54 +01:00
Dániel Bátyai 37850bbfef Fix refcount when returning with the argument in Object built-ins (#3353)
Fixes #3350.
Fixes #3351.
Fixes #3352.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-25 11:49:24 +01:00
Dániel Bátyai b2d34724d4 Fix Reflect.getPrototypeOf for primitive arguments (#3354)
Fixes #3349.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-25 11:49:04 +01:00
Dániel Bátyai 1c6f334f62 Fix class name check for WeakMap and WeakSet prototype (#3358)
Fixes #3357.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-25 11:48:33 +01:00
Robert Fancsik 62356796fc Support get/set as property name in object literal (#3340)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-22 16:05:38 +01:00
Dániel Bátyai 279d4d4119 Add handling for RegExp unicode and sticky flags (#3341)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-22 14:04:03 +01:00
Dániel Bátyai fc2218e828 Fix weakrefs when adding a key to the same container multiple times (#3343)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-22 13:55:36 +01:00
Dániel Bátyai 3bf2bc50bc Properly handle primitive arguments in Object methods (#3342)
ES2015 allows primitive arguments for most of the Object built-ins.
This change implements handling for these arguments in affected methods.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-22 12:48:10 +01:00
Zoltan Herczeg d006f068f4 Improve the performance of the interpreter. (#3344)
Registers are stored immediately after the frame pointer and an argument is dropped from vm_run.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-22 12:47:11 +01:00
Roland Takacs 996bf76f59 Support ES6 based octal literals (#3338)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs r.takacs2@partner.samsung.com
2019-11-21 15:13:11 +01:00
Robert Fancsik 2ddf134cef Add iterator close support for array destructuring (#3337)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-21 12:55:52 +01:00
Zoltan Herczeg 6b43ef8605 Arrow functions should be parsed as assignment expressions. (#3336)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-21 11:32:33 +01:00
Péter Gál aadfa13c38 Improve RegExp compatibility with web browsers (#3339)
The modification adds support to parse /A{/ like RegExps.
That is: if the iterator is invalid it should be treated as normal
character.

This behaviour is defined in the ES2015 standard Annex B 1.4 point

This only works if the `JERRY_REGEXP_STRICT_MODE` is disabled
(set to zero).

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-11-21 10:59:21 +01:00
Robert Fancsik 7f6f562adb Throw error for using rest parameter in property setter (#3335)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-20 12:21:05 +01:00
Szilagyi Adam a0a71da025 Implement toPrimitive method and Date.prototype.toPrimitve (#3287)
The algorithms are based on ECMA-262 v6 7.1.1 and 20.3.4.45

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-20 11:51:02 +01:00
Szilagyi Adam c31452c138 Implement IsRegExp operation (#3321)
Algorithm is based on ECMA-262 v6, 22.1.3.1.1

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-20 11:50:26 +01:00
Dániel Bátyai bd0cb33172 Implement WeakMap and WeakSet (#3328)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-19 19:27:31 +01:00
Robert Fancsik 830011c033 Eliminate the allocation of spread object (#3333)
ECMA_VALUE_SPREAD_ELEMENT can be used to represent that the next argument needs to be spreaded, therefore no allocation is needed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-19 18:16:43 +01:00
Zoltan Herczeg 70566a52fb Improve eval call parsing. (#3330)
Eval calls are recognised when the eval identifier is encapsulated in brackets.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-19 15:55:53 +01:00
Robert Fancsik a1189cfb62 Add validation for single statement lexical declarations (#3326)
This patch fixes #3275 and fixes #3276.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-19 15:44:12 +01:00
Robert Fancsik 134f0c0d0f Fix fast array array hole initialization (#3332)
This patch eliminates the valgrind error: "Conditional jump or move depends on uninitialised value(s)".

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-19 14:10:55 +01:00
Robert Fancsik 7295c48638 Add missing macro guard for jerry_generate_snapshot_with_args (#3331)
JERRY_CONTEXT(resource_name) must be initialized with undefined when module system is enabled.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-19 14:07:17 +01:00
Robert Fancsik 22766a855e Implement spread operator for function call arguments (#3329)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-19 14:06:12 +01:00
Zoltan Herczeg bf630c0c54 Implement binding pattern support for rest argument and for statement. (#3327)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-19 14:02:17 +01:00
Szilagyi Adam a7d129c8b2 Implement Symbol.isConcatSpreadable (#3307)
Algorithm is based on ECMA-262 v6, 22.1.3.1.1

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-19 13:55:49 +01:00
Zoltan Herczeg 8bdb32cc88 Implement function destructuring argument support. (#3322)
Furthermore create unmapped arguments objects if a function has a non-simple argument.
A few destructuring pattern issues were fixed as well.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-18 14:15:36 +01:00
Dániel Bátyai 359643b5b2 Reorganize ecma_gc_free_object (#3323)
This change cleans up object deallocation, and reorganizes the code so
that we are able to do object type specific operations before the
properties are freed.

Previously this would require extra conditions that would slow things
down regardless of object type. With this change however, object type
conditions are checked only once for each possible type.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-15 18:19:52 +01:00
Csaba Osztrogonác 8d24c70513 Make run-test-suite.py work with python3 too (#3324)
Changes:
- Use list comprehension instead of filter in get_tests
to ensure returning list instead of iterable object
- Fix unicode decoding issues with Popen call

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-15 18:12:13 +01:00
Robert Fancsik 8cf5f96c15 Introduce parser statement flags (#3318)
These flags makes the code more readable also makes the process of introducing a new statement type easier.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-15 15:57:42 +01:00
Robert Fancsik fca0c94002 Fix the initialization of let/const patterns when block context is needed. (#3320)
Also some code cuplication is removed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-15 14:38:14 +01:00
Robert Fancsik 8eda9bc1c3 Fix the usage of escaped identifiers in scanner_scope_find_let_declaration (#3317)
This patch fixes #3313.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-14 14:46:01 +01:00
Csaba Osztrogonác 12184d7922 Don't upload artifacts to AppVeyor (#3316)
Uploaded JerryScript binaries aren't useful in practice
but this step regularly fails with an error message:
"Error uploading artifact the storage: Unable to connect to the remote server"

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-14 13:58:37 +01:00
Robert Fancsik be95aa33b4 Improve delete property with undefined base (#3312)
This patch finally resolves #2891 also the removes the related bytecode since it has become unnecessary.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-14 13:53:52 +01:00
Robert Fancsik 204de302aa Fix ecma_op_get_value_lex_env_base for let/const declarations (#3311)
This patch fixes #3306.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-14 13:52:12 +01:00
Robert Fancsik 213544ae47 Implement array/object destructuring (#3305)
This patch implements the core functionality of destructuring patterns.
Function argument/for in-of pattern are currently unsupported.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-14 13:49:49 +01:00
Zoltan Herczeg b4b55a67a2 Fix for propagating arguments reference from nested blocks. (#3309)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-14 13:48:58 +01:00
Zoltan Herczeg 55c7590767 Remove PARSER_ARGUMENTS_NOT_NEEDED parser flag. (#3308)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-14 13:47:11 +01:00
Csaba Osztrogonác 84f60c19ce Fixing sudo usage for dependency installation (#3315)
Fixes #3288, the fix is same as the bug reporter suggested.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-14 10:20:30 +01:00
Csaba Osztrogonác 3b5224b98d Fix timezone in Date.prototype.toString() (#3310)
Timezone minutes part was always 0 instead of the proper value.
Additionally fixed minor typos in comments.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-14 10:13:15 +01:00
Zoltan Herczeg c0cc5a1b08 Allow extending statements with block context. (#3296)
The block contexts bound to different statements are handled in the same way.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-13 12:37:23 +01:00
Zoltan Herczeg 419ccff611 Fix local variable declaration issues after function argument initialization. (#3304)
Fixes #3298
Fixes #3299
Fixes #3300
Fixes #3302

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-13 12:35:28 +01:00
Dániel Bátyai b16b400d5b Fix cleanup upon error in String.prototype.replace (#3301)
Fixes #3297

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-12 10:54:26 +01:00
Szilagyi Adam 452c78182d Implement String.prototype.codePointAt method (#3291)
The algorithm is based on ECMA-262 v6, 21.1.3.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-11 15:54:49 +01:00
Zoltan Herczeg da69589f05 Implement for[in/of]-let construct. (#3294)
This patch implements let/const support for all "for" statements.
It includes an algorithm for cloning declarative lexical environments.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-11 13:53:32 +01:00
Zoltan Herczeg 58f71e6ffa Implement left-hand-side expression parsing. (#3292)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-08 16:20:24 +01:00
kisbg 4996542f02 Added missing logical operator in js-parser-expr (#3293)
This fix is needed to build JerryScript 2.1 on a STM board.

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2019-11-08 16:10:51 +01:00
Szilagyi Adam 798655a871 Implement Array.prototype's copyWithin method (#3269)
The algorithm is based on ECMA-262 v6, 22.1.3.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-08 15:41:20 +01:00
Zoltan Herczeg dc458111ba Local functions should not be created globally. (#3290)
Fixes #3286.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-08 14:03:19 +01:00
Szilagyi Adam 35d9b1ab17 Implement String.fromCodePoint method (#3281)
The algorithm is based on ECMA-262 v6, 21.1.2.2

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-11-08 13:48:05 +01:00
Zoltan Herczeg e1fc90db0e Delay the variable construction in the function body. (#3289)
Local variables inside the function body should be constructed after the
parameters are initialized. Furthermore arguments should be available
during parameter initialization.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-08 12:18:23 +01:00
Dániel Bátyai 923fd128b5 Refactor String.prototype.replace (#3284)
This change brings the replace operation up to date with ES6 by
implementing support for the @@replace well-known symbol, while
also improving performance and memory usage.

Also fixes #3070.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-08 12:15:28 +01:00
Robert Fancsik f48f926a39 [[HasOwnProperty]] should update the lex-env binding of argument objects (#3283)
This patch fixes #3271.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-07 11:24:07 +01:00
Robert Fancsik 859954b330 Add missing parameter description for jerry_get_resource_name (#3285)
Also some typos are fixed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-06 18:19:25 +01:00
Csaba Osztrogonác 44b1b9855d Make run-tests --jerry-tests --jerry-test-suite work on Windows too (#3260)
Changes:
* Bash based runners/run-test-suite.sh runner replaced with a python runner
* Common util functions moved to util.py
* Fixed EOL issues in tests directory

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-06 15:12:50 +01:00
Robert Fancsik 525c35f148 Introduce jerry_get_resource_name API function (#3236)
This new API function adds possibility to query the resource name of the currently executed script (including modules) or a function object.
This patch closes #2170.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-06 15:05:49 +01:00
Csaba Osztrogonác 55423ab82a Simplify ecma_builtin_date_parse function (#3280)
This PR is the preparation of the #2946 issue.
(Date.parse() should handle UTC date string format)

Changes:
- Handle min/max values in ecma_date_parse_date_chars function instead of code duplication
- Parse special characters in the new ecma_date_parse_special_char function
- Additionally fixed two parsing issue: invalid formats should be refused

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-11-06 14:51:17 +01:00
Robert Fancsik 3a505bda6b Increase the size of VM group opcodes to 256 (#3282)
Currently there is almost 115 group opcodes so increasing the number of bits which reprent a group opcode has become actual.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-06 14:49:57 +01:00
Dániel Bátyai 3b7d254e6a Add missing GC limit check to realloc with system allocator (#3279)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-11-06 11:02:28 +01:00
Ádám Kallai a8b627a80c Implement Object.is routine from ES2015 specification (#3272)
Related part of the standard: ECMA-262 v6, 19.1.2.10

JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2019-11-05 19:38:13 +01:00
Robert Fancsik 06135da642 Do not create temporary object during [[Get]] operation with primitive base (#3278)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-05 19:37:20 +01:00
Ádám Kallai f2a67876eb Fix the same Symbol value detection in SameValue function (#3273)
'is_types_equal' checks was missing for Symbol values.

JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2019-11-04 16:53:38 +01:00
Zoltan Herczeg ab8fa74b86 Correctly handle variables imported or exported by modules. (#3270)
Remove var declaration workarounds and correctly create / use variables for modules.

Still missing: create lexical environment for automatic module conversion.
(Or remove this feature overall.)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-11-04 16:51:26 +01:00
Robert Fancsik 6f83da4c0b Implement the spread operator for array initialization (#3265)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-04 16:36:58 +01:00
Robert Fancsik fc3cfc4fdc Arrow functions "prototype" property should not be lazy listed (#3268)
This patch fixes #3267.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-11-04 12:12:01 +01:00
Ádám Kallai cbae33a689 Add '-flto' flag to pkg-config if the libraries built with lto (#3274)
If we build Jerry libraries with lto, this information should be
passed to pkg-config as well.

JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2019-11-01 20:29:17 +01:00
Robert Fancsik f93fa98a75 Add Number.{EPSILON, {MAX,MIN}_SAFE_INTEGER} to the builtin descriptor (#3258)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-31 15:06:19 +01:00
Robert Fancsik eee41ec734 Support \u200C \u200D unicode characters (#3266)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-31 11:14:13 +01:00
Zoltan Herczeg 6a342fcdd6 Implement throwing ReferenceErrors for let/const variables. (#3264)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-10-31 11:09:02 +01:00
Robert Fancsik d1faed7d03 Properly release callback result in ecma_builtin_typedarray_prototype_exec_routine (#3263)
This patch fixes #3262.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-31 11:08:16 +01:00
Szilagyi Adam cc9a657425 Optimize array shift/unshift for fast-array cases (#3235)
Performance results:
Intel: 13m11s -> 0m10s
ARM: over 20m -> 2m27s

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-30 16:59:20 +01:00
Szilagyi Adam 222e774cc2 Optimize array indexOf/lastIndexOf for fast-array cases (#3233)
Performance result:
Intel: 0m27s -> 0m23,5s
ARM: 5m13s -> 4m20s

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-30 16:49:13 +01:00
Szilagyi Adam 6639bbc580 Optimize array reverse for fast-array cases. (#3231)
Performace result:
Intel: 5m30s -> 0m3,9s
ARM: over 15m -> 1m14s

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-30 16:44:29 +01:00
Szilagyi Adam d801fc70bb Optimize array slice for fast-array cases (#3213)
Performance results:
Intel: 0m27s -> 0m7s
ARM: 5m42s -> 1m26s

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-30 16:43:17 +01:00
Zoltan Herczeg 1edfa81c76 Implement correct construction of let/const declarations and function statements. (#3259)
Various cbc opcodes are added to support the different instantiations.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-10-30 16:01:55 +01:00
Robert Fancsik 1c34539997 Rework array hole calculation for fast access mode arrays (#3248)
This patch gives possibility to Array.prototype builtin routine optimizations.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-29 10:10:25 +01:00
Robert Fancsik 42ab062441 Introduce ecma_op_object_get_length and ecma_op_object_get_by_index operations (#3245)
These two functions helps to reduce code duplication, also invokes the elimination of several ECMA_TRY_CATCH macros.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-29 10:07:20 +01:00
Daniella Barsony 11818f1cb0 Fix issue about Number.prototype.toString (#3232)
Fixes #3229

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-10-29 08:35:55 +01:00
Robert Fancsik 87f60da14f Add arithmetic operations support for the API (#3249)
This patch extends the jerry_binary_operation_t list with arithmetic operations.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-28 15:46:35 +01:00
Robert Fancsik 448c239f08 Export statement parsing should construct new ident literal (#3256)
This patch fixes #3253.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-28 15:30:47 +01:00
Szilagyi Adam 072aedb4ef Fix wrong error handling in ecma_builtin_function_helper_get_function_arguments (#3257)
Fixes #3252

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-28 14:23:53 +01:00
Péter Gál eebbed143d Introduce new Promise API methods (#3186)
The new API methods make it possible to get a Promise object's
result and it's state.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-10-28 14:07:37 +01:00
Robert Fancsik 351b88184c Arrow functions prototype property should not be lazy instantiated (#3251)
This patch fixes #3250

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-28 10:33:28 +01:00
Zoltan Herczeg 3d797b8836 Implement the core of let/const statement. (#3239)
This patch implements the core part of let/const statements. Redeclarations are correctly
detected and separate contexts are correctly created for these statements. Register
optimizations are also emplyed whenever possible.

Lots of features are still missing:
 - checking the var statements in eval
 - const are treated as lets
 - single statement checks are missing
 - export declarations are exported as vars, let/const export is not supported

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-10-25 18:08:10 +02:00
Szilagyi Adam 4b352758c1 Refactor ecma_op_to_string (#3171)
Similar to the ecma_op_to_object rework, in this new method we
return directly with the pointer to the ecma string, and we don't
wrap the result into an ecma_value_t

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-25 15:58:47 +02:00
Robert Fancsik b7aa21ebc7 Fix lazy instantiation of external functions 'prototype' property (#3246)
This patch resolves #2302.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-25 15:56:37 +02:00
Robert Fancsik 100a012931 Fix integer overflow during byteLength calculation for %TypedArray%s (#3244)
This patch fixes #3243.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-25 12:36:23 +02:00
Robert Fancsik 99ad34af4a Sort function breakpoints before enabling them (#3238)
Function breakpoints should be sorted before enabling then since the object enumeration order does not grant consistent result.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-24 15:08:03 +02:00
Daniel Vince 9e83032ada Fix error type when creating TypedArray with detached ArrayBuffer (#3230)
Based on the ES2015 standard TypeError should be returned
when a TypedArray is created for a detached ArrayBuffer.

JerryScript-DCO-1.0-Signed-off-by: Dániel Vince vinced@inf.u-szeged.hu
2019-10-24 15:04:38 +02:00
Robert Fancsik 48f34adea5 General GC optimizations (#3221)
- Enable recursive GC marking with a limited recursion count (this option is configurable)
- No need to decrease the reference count of the gray objects anymore
- Bound function object marking is seperated into a helper function

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-24 14:49:47 +02:00
Robert Fancsik 3b73562fa5 Revise ES2015 feature guards (#3240)
All the basic language element guards are merged into JERRY_ES2015 macro guard.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-24 14:44:51 +02:00
Csaba Osztrogonác 59e0d6e262 Make snapshot unittest easily updatable (#3242)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-22 18:46:56 +02:00
Daniella Barsony 7b589d1381 Refactor code to use ToLength (#3210)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-10-21 14:08:13 +02:00
Virag Orkenyi 3fb6f15730 Implement Reflect object (#3036)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2019-10-21 13:46:29 +02:00
Robert Fancsik edf66f4e9b Extend the API documentation for jerry_create_string_* functions (#3234)
- The given string pointer cannot be NULL.
 - Fixed API prototype for jerry_create_string_sz_from_utf8
 - Assert is added for non-NULL pointer in lit_zt_utf8_string_size

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-21 13:42:31 +02:00
Daniel Vince 6a2767a09a Add documentation about x86 and floating-point operations (#3228)
If JerrScript is compiled for x86 then it is possible that the
floating-point operations are not correct for the JS standard.

To "fix" this the users should be advised to use at least SSE2
during build for this platform.

JerryScript-DCO-1.0-Signed-off-by: Dániel Vince vinced@inf.u-szeged.hu
2019-10-21 11:14:30 +02:00
Daniel Vince d85988af96 Implement ES2015 Function.prototype[@@hasInstance] (#3225)
Added hasInstance well known symbol implementation for Function.prototype.
This change however does not implement the ES2015 `instanceof` operator changes.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Dániel Vince vinced@inf.u-szeged.hu
2019-10-21 11:04:12 +02:00
Daniel Vince d60587f838 Add @@hasInstance Symbol support for instanceof operator (#3226)
Implemented ES2015 modifications for `instanceof` operator.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Dániel Vince vinced@inf.u-szeged.hu
2019-10-21 11:03:43 +02:00
Zoltan Herczeg 7df87b7778 Create function variables using the data produced by the pre-scanner. (#3199)
The pre-scanner now is able to track all variable declarations and produces a compressed
stream which store this data for each function and catch block. When a function or
catch block is parsed, this information is decoded and the appropriate variables are
created. Furthermore a stack scope is created which contains the currently available
local variables and their register or literal index.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-10-17 15:20:04 +02:00
Robert Fancsik fd1f7eab9f Add public API functions for internal property management (#3128)
These 4 new API functions give possibility to perform [[Get]], [[Set]], [[Has]], [[Delete]] operations for properties
which are not accessible from the JavaScript context only from the public API.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-17 13:56:49 +02:00
Robert Fancsik a40eb9bab8 Remove duplicated error raising in ecma_op_typedarray_set_with_typedarray (#3223)
This patch fixes #3222.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-17 11:56:14 +02:00
Daniel Balla fd8203ce98 Add missing error checks to API functions (#3190)
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-10-16 16:51:03 +02:00
legendecas 2e86bdae6f Add ArrayBuffer detach operations (#3208)
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
2019-10-16 16:41:27 +02:00
Szilagyi Adam 09c5d98e25 Optimize array push/pop for fast-array cases (#3187)
Performance results:
ARM: 1m19s -> 0m57s
Intel: 0m7,5s -> 0m5s

Binary size increase: 168 bytes

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-16 16:41:01 +02:00
Daniella Barsony 390916e989 Add Array.prototype.fill method (#3201)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-10-16 16:37:56 +02:00
Szilagyi Adam 5320f5a396 Use stringbuilder in typedArry toLocaleString (#3207)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-16 16:37:19 +02:00
Csaba Osztrogonác e8bc7a2b93 Update API version to 2.1.0. (#3220)
Closes #3104.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-16 15:14:56 +02:00
Robert Fancsik 8f39d90f7c Static strings should be reference counted in debug mode (#3219)
This patch helps to find out invalid reference count usage for ecma-strings.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-16 14:00:47 +02:00
Robert Fancsik 7518b7bfe6 Remove ECMA_PROPERTY_HASHMAP_SHIFT_LIMIT (#3217)
Ecma-string hash limit has already been increased to UINT32_MAX so all the string hashes can be stored directly in the hashmap.
This patch fixes #3216.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-16 13:59:43 +02:00
Zoltan Herczeg f0e432c9b9 Set post-processing mode after an arrow expression scanning is completed (#3215)
Fixes #3214.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-10-14 11:26:16 +02:00
Csaba Osztrogonác 84a56efd4f Fix undefined references build error on Windows (#3212)
We should emit symbol for ecma_make_nan_value (void), because
it is used by unit-core/test-to-integer.c and test-to-length.c.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-11 12:26:19 +02:00
Robert Fancsik fc2a2f94fd Properly release scanner info in parser_parse_for_statement_start (#3211)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-10 12:44:29 +02:00
Robert Fancsik 9e323cdcd6 Improve ecma_typedarray_info_t (#3205)
- The structure members have been renamed and the members got more detailed description.
- Updated the usage of the typedarray info structure in all occurrences to use absolute addressing from the underlying arraybuffer pointer.

This patch also fixes #3204.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-09 14:10:54 +02:00
legendecas ede1957932 Fix handle-scope unittest force conversion complaints (#3209)
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
2019-10-08 23:48:16 +02:00
Roland Takacs 6f515f079e Remove ARTIK 053 from the targets. (#3206)
ARTIK devices are no longer supported by the manufacturer.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs r.takacs2@partner.samsung.com
2019-10-08 16:50:32 +02:00
Szilagyi Adam 848a9854c3 Add missing value release in typedArray toLocaleString (#3200)
Fixes #3162

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-07 16:28:30 +02:00
Daniel Balla 7dc2d1dcd7 Fix delete operation in Set objects (#3203)
Delete should return false if an element doesn't exist in a set.
ECMA_VALUE_EMPTY wasn't checked in case of a deleted property.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-10-07 16:27:34 +02:00
Péter Gál eb97860509 Add support for Symbols when using the 'in' operation (#3202)
The change adds support for the 'in' operation to handle Symbols.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-10-07 15:31:06 +02:00
Szilagyi Adam 0f754ff33c Fix count variable calculation in typedarray copyWithin (#3158)
Fixes #3130

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-07 11:31:44 +02:00
Péter Gál 3e23a3b62f Improve documentation on native pointer API methods (#3191)
Added extra notes on the native pointer API usages to clarify
when the free callback function is invoked. Also added a note
for the free callback typedef to inform users to not call API methods
in the callback.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-10-04 16:57:16 +02:00
Zsolt Borbély e54666b448 Fix the include format of math.h (#3197)
The order of includes are also fixed.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2019-10-03 17:39:57 +02:00
Zsolt Borbély b206d60842 Remove superfluous include (#3198)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2019-10-03 17:39:21 +02:00
Daniella Barsony 466dc903fb Add toLength and toInteger operations (#3146)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-10-03 14:05:23 +02:00
Dániel Bátyai c17da4f33b Use a string builder in Array.prototype.join and toLocaleString (#3184)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-10-03 11:30:38 +02:00
Dániel Bátyai cfaecc6698 Fix an undefined read during module cleanup after parse error (#3181)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-10-03 11:01:11 +02:00
Dániel Bátyai 2180d979b7 Remove abort-on-fail from the default port (#3182)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-10-03 09:50:47 +02:00
Csaba Osztrogonác 6a848a36fd Make Date.parse handle 24:00:00.000 time properly (#3196)
ES5.1 15.9.1.15 Note1 defines that 24:00 is same as 0:00
of the next day. The spec explicitly doesn't mention that
24:01 should be invalid, but it should be self-evident.
(FireFox and Chrome also refuses times bigger than 24:00)

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-03 09:49:51 +02:00
Daniel Balla cd7720ee08 Remove test-longjmp.c (#3188)
The test is not needed anymore.
This file was added back then, when our libc had its own longjump implementation.
Now with this test we are only testing the system's longjump implementation which -in fact- works great.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-10-03 09:29:02 +02:00
Daniel Balla 64774d30ae Fix typos "enumberable" -> "enumerable" (#3189)
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-10-03 09:28:36 +02:00
Dániel Bátyai 21e17a1412 Fix null escape in character classes (#3192)
Fixes #3001.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-10-03 09:28:00 +02:00
Péter Gál 5ed8647b9e Improve example REPL to exit if there is nothing on the stdin (#3193)
When reading from the stdin a '\n' character or an empty line/file
was expected to end the read. However, in case of an input which is not terminated
with a newline a buffer overflow will occur.

Test case:
```sh
$ echo -n "print('a')" | ./build/bin/jerry
```

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-10-03 09:26:50 +02:00
Péter Gál 2096fba571 Do not add line info into the merged sources by default (#3194)
Previously the #line macro directives were always included in the
generated single source output. However, this adds quite a lot of
size to the source file (not to the binary) and it is only useful
for the library developers. Hence, it is now disabled by default.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-10-03 09:25:53 +02:00
Dániel Bátyai c3bb516e4a Refactor RegExp builtin (#3136)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-10-02 16:55:16 +02:00
Szilagyi Adam c3510fc03d Improve typedArray get, set (#3023)
Here are the following changes:
  - The getter and setter methods are callback based now, and we can use
    them with the proper typedArray id
  - The typedArray set_element and get_element methods are using memcpy now.
  - There is a new struct which contains basic informations from typedArray,
    and we are using this in most of the prototype methods.
  - Eliminated ecma_op_typedarray_set_index_prop and
    ecma_op_typedarray_get_index_prop, because these methods
    also calculated the same informations which are in the new
    struct, so we use the new method instead.

Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-10-02 16:39:26 +02:00
Dániel Bátyai f1883b9e7d Provide support for native modules with ES6 imports (#3090)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-10-02 12:20:43 +02:00
Robert Fancsik 2a89eec98b Reduce code duplication in js-parser-expr.c (#3159)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-02 12:17:45 +02:00
Csaba Osztrogonác f5e3faeaff Make ecma_number_make_nan more optimal and C99 conform (#3163)
This change makes ecma_number_make_nan and ecma_number_make_infinity
always return constant value without any function call. Previously we
relied on compiler optimizations.

The ecma_number_t_accessor union is introduced to be able to access
float values as float and uint32_t (and doubles as double and uint64_t)
properly, without violating strict aliasing rules. There were many
copies of it, all of them were replaced to this new union.

Additionally ecma_number_make_nan should return QNaN instead of SNaN,
same value as C99 nan(""). Unfortunately calling nan("") here isn't
always optimal, because compilers sometimes generate constant returns,
sometimes function calls.

Before this change ecma_number_make_nan returned SNaN:
- double: 0x7FF0 0000 0000 0001 (sign:0, exponent: all 1 bits, fraction: 0...01)
- float: 0x7F8 00001 (sign:0, exponent: all 1 bits, fraction: 0...01)

After this change ecma_number_make_nan returns QNaN:
- double: 0x7FF8 0000 0000 0000 (sign:0, exponent: all 1 bits, fraction: 10..0)
- float: 0x7FC0 0000 (sign:0, exponent: all 1 bits, fraction: 10...0)

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-02 12:17:27 +02:00
Robert Fancsik 32962f067e Fix class/function parsing in single-statement blocks (#3179)
This patch fixes #3151 and fixes #3174.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-02 11:16:52 +02:00
legendecas 07c7eb8a20 Fix python build --mem-heap document (#3185)
`--heap-size` has been renamed to `--mem-heap`
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
2019-10-02 11:16:38 +02:00
Csaba Osztrogonác 32c74fff22 Fix Date.prototype.toString() and toISOString() (#3175)
The implementation was incorrect for negative years and years bigger than 9999.
-1 was 000/ because the negative (year%10) was added to '0' character, years
bigger than 9999 was truncated to 4 digits.

ES5.1 15.9.1.15.1 defines extended years format with 6 digits, but toString()
and toISOString() sections don't mention anything about extended years. ES6
20.3.4.3 already clarifies that Date.prototype.toISOString() should use this
extended year format if it is necessary.

Changes:
- Date.prototype.toString() uses 4 digits for years by default, 5 or 6 if it
is necessary and put '-' sign for negative years, no sign for positive years.
Date.prototype.toString() was implementation dependent until ES9, but ES9
already specify exactly this format.
- Date.prototype.toISOString() uses fixed 4 digits for years 0 - 9999,
otherwise sign + 6 digits (extended years).
- Tests added for corner cases.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-02 10:26:20 +02:00
Robert Fancsik fbca37fde6 Fix argument validation for Number.prototype.toPrecision (#3176)
This patch fixes #3173

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-02 10:25:52 +02:00
Robert Fancsik 195b0d3c3a Fix duplicated argument validation for default arguments (#3178)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-10-02 10:10:23 +02:00
Csaba Osztrogonác e9664b78cd Make Date.parse accept extended years format too (#3177)
ES5.1 15.9.4.2 specifies that Date.parse (string) has to accept
at least Date Time String Format: YYYY-MM-DDTHH:mm:ss.sssZ. But
the spec allows implementation-specific fallbacks. Additionally
ES5.1 15.9.1.15.1 specifies Extended years format, but isn't
explicitly required to be accepted by Date.parse. But ES6 already
clarified that Date.parse has to accept extended years format too.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-01 15:08:16 +02:00
Csaba Osztrogonác 3763ac8371 Get rid of strict aliasing rule violations from libm (#3069)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-10-01 14:37:18 +02:00
Dániel Bátyai f7391a94ae Cleanup Valgrind macros (#3180)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-10-01 14:26:56 +02:00
Robert Fancsik 26626947c0 Inline ecma_gc_set_object_visited for performance critical code paths (#3154)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-30 16:46:31 +02:00
Robert Fancsik 57abd26c33 Optimize lcache insert (#3155)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-30 16:46:18 +02:00
Zoltan Herczeg a8fb4eee1e Fix three minor issues. (#3165)
1) Remove an unnecessary check.
 2) Check that comma is not allowed between question mark and colon
 3) Create a hex decoding variant which does not throw error.

These are quality improvements, they have no negative impact.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-27 17:38:02 +02:00
Szilagyi Adam 711b06d018 Add new check for a special corner case to typedarray lastIndexOf (#3156)
Fixes #3129
We need to check if we use the lastIndexOf method  and if the second
argument is a number, negative, and its absolute value is bigger
than the length, then  we should return with -1.

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-09-27 16:56:24 +02:00
Zoltan Herczeg 0121b2bbcf Fix object initializers for get and set properties. (#3164)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-27 10:28:53 +02:00
Csaba Osztrogonác 4eae760180 Fix undefined references build error on Windows (x64) (#3168)
We should emit function symbols for these jerry-core functions:
- ecma_compare_ecma_strings is used by test-stringbuilder.c
- ecma_is_value_number is used by test-literal-storage.c
- ecma_date_time_within_day is used by test-date-helpers.c
- jmem_heap_alloc_block is used by test-jmem.c
- jmem_heap_free_block is used by test-jmem.c
- jmem_pools_alloc is used by test-poolman.c
- jmem_pools_free is used by test-poolman.c

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-26 23:13:24 +02:00
Csaba Osztrogonác 2b3faf683d Make all test262 tests pass on Windows (#3157)
Changes:
- Implemented jerry_port_get_local_time_zone_adjustment on Windows
- Implemented jerry_port_get_current_time on Windows
- Run test262 tests on Windows in PST/PDT timezone

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-26 14:31:22 +02:00
Robert Fancsik 9ab4872244 Temporary fix for ESP8266 target on Travis (#3160)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-24 18:39:33 +02:00
Zoltan Herczeg 97a0febaff Fix comma after an arrow function. (#3153)
Fixes #3152.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-24 12:34:24 +02:00
Zoltan Herczeg 8f7565db5f Colon tokens are not optional. (#3150)
Colon tokens must be present before the next statement is executed.

Fixes #3145

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-24 12:33:06 +02:00
Csaba Osztrogonác 137dd8d1f5 Fix run-test-suite-test262.py with python3 (#3139)
subprocess.Popen needs universal_newlines=True parameter
to open the file in text mode instead of binary mode.
With this fix readline() returns str instead of bytes.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-23 22:06:02 +02:00
Zoltan Herczeg 35a3df3f28 Fix scanning of do-while statement. (#3149)
The newline before the while part is misinterpreted.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-23 15:38:15 +02:00
Zoltan Herczeg f2013fcb1a Free scanner info even if for statement parsing is failed. (#3141)
Fixes #3140.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-23 15:27:59 +02:00
Zoltan Herczeg 5c7df1cb2d Rework simple arrow function scanning. (#3148)
The resulting code unifies the scanning of the two
different argument definition of arrow functions.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-23 15:25:37 +02:00
Csaba Osztrogonác 053b05f185 Fix Cygwin build (#3147)
Fixes #3142.

Changes:
- Disable LTO on Cygwin build because of a Cygwin-ld bug.
- Don't add "-z noexecstack" to ld because it is ELF specific option.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-23 14:56:11 +02:00
Zoltan Herczeg 25b81c106c Implement statement parsing in the scanner. (#3137)
To implement let/const, the code affected by for statements needs to be identified,
and this patch implements the basic infrastructure for that. The short term benefit
is that scanner info blocks are not generated for do-while blocks.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-20 12:15:16 +02:00
Zoltan Herczeg a7c654617d There is no need to update the scanner info chain after a for/while statement. (#3138)
Fixes #3131.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-20 02:27:05 -07:00
Csaba Osztrogonác 1acbf83d1a Disable unsupported doctest tests on Windows (#3135)
Disable 02.API-REFERENCE-create-context.c, because
it is based on pthread, and there is no pthread on Windows.

Disable 11.EXT-REFERENCE-AUTORELEASE.c and test-ext-autorelease.c
if compiler is MSVC, because MSVC doesn't support cleanup attribute.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-20 11:07:06 +02:00
Csaba Osztrogonác 6c03e0f0af Fix undefined references build error on Windows (#3134)
We should emit function symbols for ecma_get_magic_string
function, because it is used by unit-test-stringbuilder.c.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-20 11:05:43 +02:00
Csaba Osztrogonác b1115fbcfc Disable test-mem-stats.c unittest if system allocator is used (#3133)
If system allocator is used jerry_heap_stats_t.size
is always 0 and we can't get detailed heap statistics.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-20 10:07:32 +02:00
Csaba Osztrogonác dc44b8b933 Disable INIT_FINI unittest on Windows (#3132)
MSVC doesn't support library constructor/destructor, let's disable
the related unittest and clarify the documentation and error messages.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-20 10:04:55 +02:00
Csaba Osztrogonác c05686b668 Fix jerry_get_context_data() API function (#3127)
If manager_p->bytes_needed == 0, jerry_get_context_data() should return
NULL pointer. Additionally init_cb, deinit_cb and finalize_cb should be
called with NULL pointer in this case.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-17 17:31:46 +02:00
Zoltan Herczeg 40e63d1207 Implement seeking in the pre-scanner info. (#3126)
After changing the lexing position, the current
position of the scanner info must be moved as well.

Fixes #3101
Fixes #3102

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-17 17:28:11 +02:00
Szilagyi Adam 0eae2f6207 Add new check to typedarray copyWithin (#3108)
We should check if the start index is equal or greater than the end index,
if thats the case, we should return with the original typedArray.

Fixes #3107

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-09-17 17:24:47 +02:00
Csaba Osztrogonác 62f8d7c885 Fix stack overflow in unit-core/test-api.c (#3125)
We have to use jerry_get_string_size() to get the necessary buffer
size instead of jerry_get_string_length() and jerry_json_stringify().

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-16 13:00:37 +02:00
Robert Fancsik 4452e79204 Class expression scanning must be continued with post primary expression scanning. (#3120)
This patch fixes #3117 and fixes #3119.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-16 12:58:14 +02:00
Robert Fancsik 8d9788d1b5 Fix incorrect assertion while decoding the literal argument index (#3118)
This patch fixes #3114.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-16 12:56:48 +02:00
Daniel Balla aa8832a985 Fix string size calculation in builtin string repeat (#3116)
Fixes #3105

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-09-16 12:55:33 +02:00
Robert Fancsik 436fcbb4b7 Fix [[Delete]] operation for fast arrays. (#3115)
When popping the last element from a fast array the underlying buffer must be released.
This patch fixes #3106.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-16 12:54:16 +02:00
Zoltan Herczeg 62025cfa41 Support new Function parsing in the pre-scanner. (#3110)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-16 11:58:15 +02:00
Daniel Balla 87441635e1 Add error check to VM_OC_CLASS_INHERITANCE (#3122)
ecma_op_object_get_by_magic_id can throw an exception

Fixes #3121

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-09-16 11:32:56 +02:00
Robert Fancsik 83c44d20b3 Fix skipping empty statements during class literal scanning (#3124)
This patch fixes #3123

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-16 11:26:08 +02:00
Daniel Balla 17e63e892a Fix overflow in ecma_op_dataview_create (#3111)
Fixes #3109

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-09-13 07:19:49 -07:00
Daniel Balla 9f85d21578 Add string iterator to ecma_object_check_class_name_is_object function (#3113)
Fixes #3112

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-09-13 07:15:33 -07:00
Zoltan Herczeg 951d7e6842 Implement var statement pre-scanning. (#3103)
The patch also checks whether pre-scanning is successful when scanning is,
so no need for explicit pre-scanner checks anymore.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-13 06:36:41 -07:00
Szilagyi Adam 6e79bb148e Add toLocaleString for TypedArrays (#2987)
The algorithm is based on ECMA-262 v6, 22.2.3.27

Co-authored-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-09-13 13:40:56 +02:00
Zoltan Herczeg 376cfea47e Parse rest function arguments in the pre-scanner. (#3099)
Fixes #3097.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-12 09:04:00 -07:00
Zoltan Herczeg 57de923770 Support get/set function declarations in classes in the pre-scanner. (#3098)
Fixes #3094
Fixes #3095
Fixes #3096

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-12 16:09:13 +02:00
Robert Fancsik fc30f003ba Rework ecma collection (#3086)
After this patch the ecma value collection is a resizable buffer of ecma-values where the adjacent elements are allocated next to each other.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-12 13:05:24 +02:00
Zoltan Herczeg f3d3c34c30 Fix pre-scanner function name parsing. (#3093)
The function names of classes were incorrectly parsed.
Also made the parsing more strict (more issues were captured by the pre-scanner).

Fixes #3088
Fixes #3089

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-11 16:55:58 +02:00
Zoltan Herczeg fbde788d1f Scanner rework. (#3038)
The scanner was an on-demand tool of the parser, which was triggered by certain
statements. After the rework, the scanner runs only once, and collects all information.
This information is passed to the parser.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-11 11:15:46 +02:00
Dániel Bátyai 6221b670d1 Keep GC object list in the order of traversal (#3087)
By appending to the end of the black object list during garbage
collection, the resulting object list will be sorted in the order of
traversal. This allows subsequent gc runs to mark surviving sub-trees in
a single iteration.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-09-11 10:54:03 +02:00
Robert Fancsik 83459c1fac Fix String.prototype.repeat for empty strings (#3085)
This patch fixes #3084.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-10 15:03:53 +02:00
Robert Fancsik c04fe24253 Ensure that Map/Set object keys can always have MAP_KEY_STRING internal property (#3065)
This patch fixes #3062.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-09 10:38:22 +02:00
Robert Fancsik 9fbd0cce6c Fix fast access mode arrays delete property operation (#3073)
The old last element should be released before reallocating the underlying buffer

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-09 10:37:17 +02:00
Robert Fancsik e04bbdfff4 Fix byteLength validation in DataView constructor (#3074)
This patch fixes #3072.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-09 10:37:01 +02:00
Robert Fancsik c79659d3b2 Fix array initialization with array holes (#3076)
Fast mode access arrays must be converted back to normal if the array hole count reaches the limit during the initializtaion.
This patch fixes #3075.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-09 10:36:48 +02:00
Robert Fancsik 3111d0e0f2 Fix the internal object reference count in Map/Set.prototype.forEach (#3081)
This patch fixes #3079.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-09 10:36:33 +02:00
Dániel Bátyai 115ad9a41c Fix JSON.stringify for non-serializable properties (#3083)
Fixes #3082.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-09-08 23:49:27 +02:00
Robert Fancsik 2933947534 Properly decode literal index before CBC_MOV_IDENT (#3056)
This patch fixes #3055.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-07 12:23:49 +02:00
Péter Gál 5d51fe8f27 Fix TypedArray.slice with external array buffer (#3080)
In case of TypedArrays which were constructed with an ArrayBuffer
the `slice` method incorrectly added the `byteOffset` value of
when the elements were copied.

There is no need to add the `byteOffset` value for the ArrayBuffer's
contents pointer as it is already added by the `ecma_typedarray_get_buffer`
call.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-09-07 12:22:20 +02:00
Robert Fancsik 91818bea93 Limit the constructed string size in String.prototype.repeat (#3066)
This patch fixes #3063.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-07 12:20:57 +02:00
Péter Gál 1b84a17dc7 Correctly propagate super prop ref when parsing expressions (#3077)
The "super prop ref" flag is incorrectly used at multiple expressions
as it was only cleared if there was an assignment operation.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-09-06 16:56:04 +02:00
Péter Gál 57f389dcf4 Add backtrace print when the 'assert' js method fails (#3051)
In the jerry-ext there is a native 'assert' handler implemented.
This change adds extra backtrace information if an 'assert' call fails.

To print out the backtrace the library should be built with `JERRY_LINE_INFO` enabled.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-09-05 13:07:21 +02:00
Zoltan Herczeg 96edec1a62 Improve expected identifier checks. (#3064)
Checks for "of" or "from" does not accept quoted strings.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2019-09-05 11:42:17 +02:00
Robert Fancsik 086c4ebf13 Fix array hole calculation for fast access mode arrays (#3061)
This patch fixes #3060.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-05 10:16:27 +02:00
Robert Fancsik 142f79ce05 Properly handle CBC_PUSH_THIS_LITERAL for unary lvalue operations (#3054)
This patch fixes #3048.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-05 09:52:58 +02:00
Robert Fancsik 4afcc709b8 Add fast array support for property name enumeration (#3053)
Since fast access mode arrays can be part of the prototype chain these objects must be handed separately.
This patch fixes #3050.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-05 09:49:56 +02:00
Szilagyi Adam 24196b69da Add copyWithin and slice function to TypedArray (#2984)
The algorithm's are based on ECMA-262 v6, 22.2.3.5 and 22.2.3.23

Co-authored-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-09-05 02:12:24 +02:00
Robert Fancsik 1c4cfe3e20 Property release the callback result in Array.prototype.[find/findIndex] (#3052)
This patch fixes #3049.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-05 01:42:16 +02:00
Dániel Bátyai 8bccbbf08f Refactor JSON builtin methods (#3031)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-09-05 01:25:19 +02:00
Robert Fancsik 1088273bc3 Prevent fast access mode arrays from low-level property management methods (#3047)
This patch fixes #3043 and fixes #3045 and fixes #3046.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-04 10:41:29 +02:00
Csaba Osztrogonác 3e661c0c5a Make run-tests --test262 work on Windows too (#3029)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-04 10:29:21 +02:00
Csaba Osztrogonác a315a6534e Disable failing buildoption tests on Windows (#3027)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-04 07:59:22 +02:00
Daniel Balla 14e4476084 Don't use ecma_create_named_data_property in fast mode arrays (#3042)
Remove invalid use of named data properties in fast mode arrays.
Fixes #3040

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-09-03 19:43:41 +02:00
Daniel Balla e79059c94b Fix an issue when shrinking arrays (#3041)
There was an issue with fast arrays not correctly inserting "holes" when shrinking them.

Fixes #3039

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-09-03 17:47:45 +02:00
Robert Fancsik 91e87fe34f Fix the limit of the maximum number of directly stored properties in a hashmap (#3032)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-03 17:46:47 +02:00
Robert Fancsik 952fb23e0e Skip fast access arrays during hashmap frees (#3033)
Also this patch fixes some small issues during the fast array construct process.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-09-03 17:45:55 +02:00
Daniel Balla 29758101a3 Add symbol support to same_value function (#3030)
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-09-02 13:52:53 +02:00
Daniel Balla ea77a79461 Add missing feature guard to jerry_create_typedarray_for_arraybuffer function (#3035)
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-09-02 13:52:35 +02:00
Csaba Osztrogonác 3ba6adcc71 Make run-tests --unittests work on Windows too (#3026)
Changes:
* Bash based unittest runner replaced with a python runner
* Typo fixed in doctest cmake build system (python executable)
* run-tests.py prints error message if build fails

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-09-02 12:52:16 +02:00
Robert Fancsik 2f1908f894 Implement fast access mode arrays (#3028)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-30 15:18:15 +02:00
Robert Fancsik c6a4a86257 Improve ecma_string_t descriptor (#3016)
This patch introduces several changes conntect to ecma-strings:
 - Extend the size of the reference counter to 28 bytes from 13
 - Extend the size of the string hash to 32 bytes from 16 to use the extact FNV-1a hash
 - Introduce ECMA_STATIC_STRING_FLAG to reduce the number of string ref/derefs for static strings.
 - Introduce ECMA_STRING_CONTAINER_ASCII_STRING to store run-time allocated ASCII strings more efficiently
 - Remove ECMA_STRING_CONTAINER_LIT_NUMBER to half the storage size of the parsing time allocated floating point numbers
 - Rework the global number storage, to store only the floating point numbers
 - Optimize the lookup in the global number/string/symbol tables via reduce the number of NULL checks during decompressing the next element pointers
 - Reduce the code duplication in ecma_concat_ecma_strings and ecma_append_chars_to_string
 - Improve ecma_string_get_char with optional arguments to make it more reusable.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-30 15:16:27 +02:00
Szilagyi Adam f0578b2c25 Add indexOf and lastIndexOf function to typedArray (#2938)
The algorithm's are based on ECMA-262 v6, 22.2.3.13, 22.2.3.16

Co-authored-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-08-30 14:01:30 +02:00
Dániel Bátyai e3c1451d42 Add missing Valgrind macros to jmem (#3025)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-28 14:59:06 +02:00
Dániel Bátyai 5fa0a690eb Look up the previous block again after a GC in jmem_heap_realloc_block (#3021)
Garbage collection can create new free blocks in the heap structure as
it releases memory, so the previous block needs to be looked up again
if a GC happens during a realloc.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-28 14:58:35 +02:00
Moe Ghasemi 26d48c3e28 Adding a switch to the jerry-snapshot tool to load a function (#3024)
The -f and --generate-function-snapshot switch are added to the jerry-snapshot
command line tool so the entire javascript input can be interpeted and
loaded as a function snapshot. The function arguments must be given in
the command line.

Example:
echo "return a + b;" > myfunc.js
./jerry-snapshot generate -f "a, b" myfunc.js

JerryScript-DCO-1.0-Signed-off-by: Moe Ghasemi mghasemi@sierrawireless.com
2019-08-27 22:52:46 +02:00
Csaba Osztrogonác 744a64c6fd The sample git hook shouldn't duplicate signed-off (#3022)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-08-27 18:28:43 +02:00
Robert Fancsik ee1da14577 Optimize ecma_builtin_helper_def_prop. (#3007)
This patch removes the ecma_property_descriptor_t structure bitfields and substitutes it with an uint16_t flag field
to reduce the cost of the transformation from/into the ecma_property_flags_t.
Also the is_throw last arguments is embedded to the property descriptor structure during the property defining process to reduce the number of arguments of the function.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-27 18:28:03 +02:00
Virag Orkenyi d0435e1db0 Implemented Number object routines (#2972)
Implemented Number.isNaN & Number.isFinite &
Number.isSafeInteger & Number.isInteger & Number.EPSILON.

JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2019-08-27 10:18:51 +02:00
Robert Fancsik 47f2f0ea8b General optimizations around compressed pointer management (#3019)
ECMA_GET_POINTER is removed from:
 - property list iteration
 - lexical environment chain iteration
 - prototype chain iteration

For all these iteration the compressed pointer can be used to get the elements and only decompressed them if it is necessary.

- Properly guard ecma property hashmap routines
- Remove the redundant NULL pointer check from ecma_create_property
- Remove ecma_gc_get_object_next since it became unnecessary
- Substitute ECMA_{GET,SET}_POINTER with ECMA_{GET,SET}_NON_NULL pointer when we can assume the pointer is not NULL
- Remove ecma_get_object_prototype and ecma_get_lex_env_outer_reference helper function the reduce the number of NULL pointer checks during decompressing the pointers
- Remove ecma_get_named_accessor_property_{getter,setter} helper functions for also reduce the number of NULL pointer check/decompressions
- Remove ECMA_PROPERTY_SEARCH_DEPTH_LIMIT since in ES5 there is no way to create circular prototype chain, and the ES2015 setPrototypeOf method can resolve this error so this check during the property lookup can be eliminated.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-26 17:42:02 +02:00
Szilagyi Adam 97e348528a New trim helper function (#3014)
Created a new trim helper function which is used in every situation where we need to trim a string

Co-authored-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-08-26 17:30:21 +02:00
Csaba Osztrogonác fd075322fb Fix building with build.py on Windows (#3013)
Changes:
  - gen-doctest.py: Use slashes in paths to make cmake happy.
  - unit-doc/CMakeLists.txt: Don't add invalid arguments to MSVC and call gen-doctest.py properly.
  - build.py: Build and install with cmake calls on Windows.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-08-26 17:27:30 +02:00
Robert Fancsik b47c36ad18 Eliminate ECMA_TRY_CATCH macros part I. (#3006)
Also this patch introduces several helper function to find/put/delete properties by indexed property names to reduce code duplications.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-26 17:20:00 +02:00
Robert Fancsik 3af0079a0e Introduce CBC_MOV_IDENT opcode to improve performance (#3020)
After this patch CBC_ASSIGN_SET_IDENT is transformed to CBC_MOV_IDENT if the opcode has register stored literal argument.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-26 15:59:27 +02:00
Dániel Bátyai 996459714c Add string builder helper (#2999)
This change adds a new string builder type, that can be used to construct
strings internally by appending various types of other strings.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-26 15:57:03 +02:00
Dániel Bátyai ddd48b30f0 Don't run Coverity as the last task on Travis (#3017)
Follow-up after #3008

Having Coverity as the last task is fine for pull requests, but on the
master branch, where the task actually performs the scans, it can have a
large delay on the builds.

This change moves the Coverity task back to the middle ground, and puts
the ESP8266 build as the last, which seems to always run fast. This saves a
few extra minutes of build time on the master branch.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-17 08:47:29 +02:00
Dániel Bátyai d29364c34e Update Zephyr build on Travis (#3018)
Follow-up after #3015

The fix backport has landed, and the branch has been deleted. Revert back to
the the v1.14 branch.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-16 19:05:40 +02:00
Daniella Barsony 77237960a7 Add tool to transpile JavaScript sources using Babel (#3009)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-08-15 14:53:33 +02:00
Dániel Bátyai 3c69dfab2c Fix Zephyr build on Travis (#3015)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-13 15:50:10 +02:00
Csaba Osztrogonác 54a5a650aa Fine-tune pylint and debugger test scripts (#3012)
- Added pylint and python-serial to apt-get-install-deps.sh.
- Make Jerry debugger import python serial module only if needed.
- Check-pylint.sh warns if pylint isn't installed.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-08-13 14:23:45 +02:00
Csaba Osztrogonác ff2e75ed2e Fix buffer overflow in example for jerry_string_to_char_buffer() API function (#3010)
We need one more byte allocated for the trailing '\0'.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-08-08 21:31:59 +02:00
Dániel Bátyai a834288096 Speed-up Travis builds (#3008)
This PR reduces the time it takes for Travis to complete the checks.
The following changes are made:
  - Disabled LTO for test builds
  - Merged Debugger tests into x86-64 Conformance tests
  - Moved the INIT_FINI unittests into the regular unittests
  - Merged SonarQube and Coverity Scan tasks
  - Re-arranged some of the tasks

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-07 18:34:45 +02:00
Dániel Bátyai 566e81451e Add realloc function to jmem (#2998)
This patch extends jmem functionality by adding a realloc function.
This opens up other paths of optimization which can result in smaller
peak memory usage and faster execution times, due to not having to
duplicate memory when we need to extend blocks.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-06 17:59:49 +02:00
Dániel Bátyai 3b7475b01d Add build option for changing the heap limit (#3005)
This change adds a build option that allows adjusting the garbage
collection heap usage limit, which can be used to fine-tune how often
garbage collection should be triggered.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-08-06 13:35:26 +02:00
Robert Fancsik dec9dbc926 Reduce the size of the jerry_context_t structure (#2981)
This patch substitutes several global pointer with compressed pointers to reduce the size of the structure.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-08-06 13:18:44 +02:00
Csaba Osztrogonác 14a9a1a1f0 Fix undefined references build errors on Windows (#3004)
We should emit function symbols for ecma_date_day, ecma_is_value_string and
ecma_number_is_nan inline functions, because they are used by unit tests:
unit-core/test-date-helpers.c, test-literal-storage.c and test-string-to-number.c.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-08-06 13:02:08 +02:00
Csaba Osztrogonác 9c7511221f Don't use VLA's in unit tests and API examples (#3002)
MSVC doesn't support C99 VLA (variable-length array).
Use fixed size arrays in API examples and use JERRY_VLA macro
in unit tests to make these tests buildable on Windows too.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-08-06 13:01:01 +02:00
Csaba Osztrogonác 051febfed7 Fix unused parameter related build issues on Windows (#3003)
MSVC doen't support __attribute__((unused)),
we should use JERRY_UNUSED macro instead.

Additionally removed the internal jrt.h include from
tests/unit-core/test-common.h which was layering violation.
It made JERRY_ASSERT unavailable, we should use TEST_ASSERT.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-08-06 10:13:41 +02:00
Péter Gál 27da5a538c Update API version number (#3000)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-08-01 13:24:41 +02:00
Péter Gál 8ebd3230a1 Make sure that snapshot API return values are the same as in the docs (#2997)
The snapshot API docs describe that those functions returns error if
the related features are not enabled. Updated the return values to follow
the API documentation.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-31 19:23:55 +02:00
Péter Gál 1409a68dcb Generate jerryscript-config.h before build (#2934)
Previously after the library was build there was no easy way
to get back the information of how it was build.

This change adds a bit of CMake code to generate the
jerryscript-config.h file containing the default options
and adding the modified build options/features.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-31 19:21:24 +02:00
Péter Gál c90306449e Correctly handle call arguments when using 'super' calls (#2996)
There are two interconnected changes here:
* Added missing argument number handling for `super.propname(..)` calls.
* The `super.propname.call(...)` is does not need extra 'this' binding helper.

Fixes #2990.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-31 15:13:06 +02:00
Dániel Bátyai dfafb1aa6b Fix unhandled exceptions with unicode error messages (#2994)
Fixes #2993

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-30 19:48:56 +02:00
Dániel Bátyai a2d242eab9 Use python3 for mbedOS build on Travis (#2995)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-30 16:46:16 +02:00
Péter Gál 99b061ad10 Fix incorrect feature guard for class support (#2992)
In `ecma-helpers.c` there was an incorrect macro guard which
tested the `JERRY_ES2015` feature but the `JERRY_ES2015_CLASS`
feature should be tested instead.

Profile options for testing:
* JERRY_ES2015=0
* JERRY_ES2015_CLASS=1
* JERRY_ES2015_OBJECT_INITIALIZER=1

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-29 14:29:21 +02:00
Péter Gál c64ee882da Introduce new jerry-ext methods to ease property registration (#2715)
New methods
* jerryx_set_properties: Allows multiple property registration for via a single call
* jerryx_set_property_str: Allows property registration without the need to
    create the property name JS value. The property name can be directly passed
    as a `const char*` value and must be zero terminated.
* jerryx_get_property_str: Allows getting a property value on a given object.
    The property name can be directly passed as a `const char*` value.
* jerryx_has_property_str: Allows checking if a property exists on a given object.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-25 20:37:44 +02:00
Péter Gál 3e12738037 Improve single-source generation (#2989)
Detected and fixed minor issues with the single-source generation:
* On Windows the line info generation now correctly escapes the path separators.
* Fixed an incorrect C file include order. Now the global object C file is
  force included to get all common headers at the start in the generated source
  file.
* Added a missing colon which fixed the correct removal of the config.h include.
* Fix the command line help.
* Small typo fix.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-25 20:34:12 +02:00
Dániel Bátyai 6744376bbe Add Configuration doc to the README (#2988)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-25 20:33:20 +02:00
Istvan Miklos 7575fa454a Migration Guide (#2419)
* Migration Guide

Migration guide from JerryScript 1.0 to 2.0.

Co-authored-by: László Langó llango.u-szeged@partner.samsung.com
Co-authored-by: Peter Gal pgal.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu

* Add version information for API methods

For each API method/type the documentation now includes
the version it was introduced or a change occured.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-25 20:33:03 +02:00
Dániel Bátyai d3c78d8c6a Improve lastIndex calculation in RegExp match (#2982)
Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-25 18:20:51 +02:00
Péter Gál 50be3a5384 Document and improve the single-source generation (#2986)
Changes done:
* Added usage/configuration info for this mode.
* Created `tools/srcgenerator.py` to allow source/header generation
  without using CMake.
* Adapted CMake to use the `srcgenerator.py` script.
* Added jerry-libm single-source build.
* Improved the `srcmerger.py` script to correctly handle the line numbering.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-25 12:46:00 +02:00
Csaba Osztrogonác 7685afddf9 Fix Math.pow (#2985)
The Math.pow implementation calls libm's pow. The ISO C and ES5.1
standards differ on some special cases of pow. jerry-libm is already
ES5.1 conform, but system libm libraries on Linux and Windows aren't.

Math.pow(NaN, +/-0.0) is NaN on Windows and Linux with system libm,
but should be 1.0 according to ES5.1 / 15.8.2.13.

This patch handles this special case in Math.pow instead of calling pow of libm.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-07-24 19:41:03 +02:00
Szilagyi Adam ea577d6ed0 Add keys, values, entires functions for typedArray (#2925)
Extended the typedArray functionality based on ES2015

Co-authored-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-07-24 15:48:28 +02:00
Péter Gál 434994eb67 Add extra details for the api example page (#2956)
Add simple examples and details on how to execute them.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-24 15:47:55 +02:00
Csaba Osztrogonác 81c3763a30 Update README.md after renaming 01.GETTING-STARTED.md (#2983)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2019-07-24 11:41:35 +02:00
Dániel Bátyai 5d6eebac4c Add documentation for configuration options (#2977)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-23 15:32:41 +02:00
Robert Fancsik 4a9e185840 Rework the engine's internal recursion limit (#2969)
This patch unifies the recursion limit checking for RegExp, function call and JSON as well.
Until now the limit was only a counter which was increased/decreased at certain points.
This counter has been substituted with a numeric limit which allows to restrict the stack usage.

This patch fixes #2963 and resolves the closed #2258 issue.

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-23 15:31:37 +02:00
Péter Gál f53dba1a3a Add dependency info for accessing memstats from API (#2979)
The documentation of `jerry_get_memory_stats` method was missing
the requirements on what build option or feature is required.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-22 11:15:19 +02:00
Dániel Bátyai ec11a7b4e9 Resolve module paths relative to the current module (#2976)
The current module implementation resolves module paths relative to the
current working directory, but paths should be resolved relative to the
currently evaluated module/source.

This requires a change in the jerry_port_normalize_path port API
function, so that it also takes the current module path as an argument.
On the engine side, we now also create a module object for the main
script, so that we can properly identify the base path for other
modules.

Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-17 14:44:18 +02:00
Robert Fancsik 6c441091b4 Optional arguments should advance the iterator in jerryx_arg_transform_optional (#2962)
This patch fixes #2288

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-17 14:16:41 +02:00
Dániel Bátyai ff22634e27 Refactor memory management (#2954)
This PR is a general cleanup for garbage collection and memory
allocation code paths.

Changes:
  * Removed an unnecesary local variable from 'ecma_gc_mark'.
  * Refactored 'ecma_gc_run' to have an implicit list head during
    iteration, which results in one less condition in the loops,
    and changed the loops to use compressed pointers to reduce the
    overall amount of compression/decompression.
  * Renamed 'jmem_free_unused_memory_severity_t' to 'jmem_pressure_t',
    and added additional values.
  * Removed 'jmem_free_unused_memory_callback', instead
    'ecma_free_unused_memory' is now called directly.
  * Reworked 'ecma_free_unused_memory' to handle all code paths related
    to 'jmem_pressure_t', and moved all relevant code paths into this
    function. This simplifies the code paths in other places.
  * Reworked 'jmem_heap_gc_and_alloc_block' to be more streamlined.
  * Changed mem-stats to not report unused pool chunks as allocated
    memory.
  * Created an allocator internal API for allocating/freeing memory blocks
    that are not reported as used memory in mem-stats.
  * Removed iteration statistics for the jerry allocator from mem-stats,
    as they don't provide any actually useful information.

Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-17 14:12:23 +02:00
Dániel Bátyai a44d584842 Fix 'eval' checking in import/export statements. (#2978)
Fixes #2975

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-17 14:11:13 +02:00
Robert Fancsik 329b1fd3f7 Use custom dispatcher for Number.prototype routines (#2968)
Binary size gain:
     - Intel: ~630B (gcc-7.3)
     - Arm: ~280B (arm-linux-gnueabi-gcc-7.3)

Futher improvements:
 - Separate toFixed, toExponential, toPrecision common part into a helper function

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-17 14:10:20 +02:00
Robert Fancsik 7aa3bfdc6d Use custom dispatcher for Function.prototype routines (#2967)
Binary size gain:
     - Intel: ~70B (gcc-7.3)
     - Arm: 50 B (arm-linux-gnueabi-gcc-7.3)

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-17 14:10:05 +02:00
Robert Fancsik c0b8845530 Use custom dispatcher for Object routines (#2966)
Binary size gain:
     - Intel: ~370B (gcc-7.3)
     - Arm: ~240B (arm-linux-gnueabi-gcc-7.3)

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-17 14:09:44 +02:00
Robert Fancsik f158dd4fb5 Use custom dispatcher for Object.prototype routines (#2965)
Binary size gain:
     - Intel: ~250B (gcc-7.3)
     - Arm: ~65B (arm-linux-gnueabi-gcc-7.3)

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-17 14:09:29 +02:00
Robert Fancsik 603cd88006 Use custom dispatcher for String.prototype routines (#2964)
Binary size gain:
     - Intel: ~1.3KB (gcc-7.3)
     - Arm: ~650B (arm-linux-gnueabi-gcc-7.3)

Co-authored-by: Marko Fabo mfabo@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-17 14:09:14 +02:00
Robert Fancsik a21a4191ca Improve RegExp.prototype.compile (#2971)
This patch fixes the return value of the routine also fixes several incorrect regression-tests
due to the previously incorrect [[RegExpMatcher]] internal slot check.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-17 08:14:38 +02:00
Robert Fancsik 2700e66c4b Improve class literal parsing (#2970)
Until now "get"/"set" were always parsed as special 'keywords' for accessor methods,
but they should be parsed as simple class method if no identifier is followed by them.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-16 13:52:05 +02:00
Robert Fancsik 6bd7d70a69 Fix Lcache and property hashmap related buildoption tests (#2973)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-16 13:04:40 +02:00
Dániel Bátyai 75728980a3 Fix mbedos5 build on Travis (#2974)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-15 20:21:00 +02:00
Virag Orkenyi 3c2088cf7b Math.sign and Math.trunc (#2943)
JerryScript-DCO-1.0-Signed-off-by: Örkényi Virág orkvi@inf.u-szeged.hu
2019-07-11 19:42:27 +02:00
Dániel Bátyai c304b9a38a Include file path in Syntax error messages (#2941)
When using ES6 modules it was not possible to identify which module
an error originates from.

This PR changes the error message to also include the file path using
the file:line:column format, and updates the source context printing for
unhandled exceptions to use the correct file.

Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-11 12:33:02 +02:00
Robert Fancsik 3f47e1b0aa Container object's internal object must be allocated firstly (#2961)
This patch slightly reworks the container objects internal objects allocation.
This rework allows the same lifetime of the objects without the manual allocation/deallocation of the internal object.

This patch also fixes #2951.

Co-authored-by: Dániel Bátyai <dbatyai@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-11 12:32:17 +02:00
Robert Fancsik a3cd2d7ff6 This argument must be pseudo-array in {Map/Set}Iterator.prototype.next routine (#2960)
This patch fixes #2950.

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-11 11:33:17 +02:00
Robert Fancsik 06000b5161 Fix the repeat count checking in String.prototype.repeat (#2959)
This patch fixes #2948

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-11 11:32:11 +02:00
Robert Fancsik 788fdc6603 Add missing release value call to %TypedArray%.prototype.findIndex routine (#2958)
This patch fixes #2947

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-11 11:31:04 +02:00
Péter Gál 1374d5f562 Update and improve API documentation (#2952)
A few parts of the API documentation was not clear enough.
Added extra details and examples.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-10 22:43:33 +02:00
Daniella Barsony d4ce20d0fd Implement String startsWith/includes/endsWith (#2926)
Co-authored-by: Tamas Keri tkeri@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-07-10 14:41:38 +02:00
Dániel Bátyai 04d5d56a68 Fix URLs in the repository after organization switch (#2955)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-07-09 19:13:57 +02:00
Péter Gál ef5dd5c698 Rework CMake options to use the new macro config format (#2933)
Updated all feature related CMake option to use JERRY_ format.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-08 18:25:17 +02:00
Robert Fancsik 2b8c428694 Improve gen-unicode.py to support unicode ranges (#2944)
This patch fixes #2936

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-05 15:44:56 +02:00
Robert Fancsik e902b870aa Limit the call stack size for native/builtin functions as well (#2935)
VM_RECURSION_LIMIT only prevented the recursion of interpreted codeblocks but
native/builtin function calls can also create stack overflow due to the too deep recursion.

This patch fixes #2905.

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-05 12:21:48 +02:00
Robert Fancsik 8766bb3b37 CBC_PUSH_THIS_LITERAL must be converted back to CBC_PUSH_THIS during emitting unary lvalue opcode (#2939)
This patch fixes #2937.

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-04 18:26:46 +02:00
Akos Kiss d22f6b451b Add pull request template (#2942)
Provide contributors with a checklist to ensure quality PRs and to
avoid common pitfalls. The items in the checklist are mostly beyond
the capabilities of automated checker tools and more like reminders
of best practices. Still, they can save lot of valuable reviewer
time (hopefully).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-07-04 10:35:05 +02:00
Akos Kiss b137942ea7 Add issue template for bug reports (#2940)
Help both the community and ourselves by describing what
information is required in a bug report.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-07-02 16:12:40 +02:00
Robert Fancsik a72d14f575 Make API unavailable while processing native free callbacks (#2932)
This patch fixes #2889 and extends the API documentation of the native free callbacks.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-07-02 15:46:19 +02:00
Péter Gál eef1efa394 Rework usages/naming of configuration macros [part 3] (#2927)
Reworked the JERRY_DEBUGGER macro to be a 0/1 switch.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-07-01 13:12:19 +02:00
Szilagyi Adam 1ea77cc490 Fix buffer-overflow in ecma_op_typedarray_set_with_typedarray (#2922)
Wrong method were used to get the source buffer pointer
Fixes #2851

Co-authored-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-07-01 13:09:39 +02:00
Akos Kiss dea73d87e8 Hide info about --libfuzzer in tools/build.py behind --devhelp (#2929)
This reduces the noise when a user asks for help via `--help`, as
libfuzzer support is very developer-only.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-06-28 11:03:49 +02:00
Robert Fancsik f6f52a2bf1 Update the internals documentation (#2923)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-27 12:56:06 +02:00
Akos Kiss de71fe4f71 Fix implicit integer conversion reported by Clang 8 (#2928)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-06-27 09:53:00 +02:00
Robert Fancsik 9d4c2315f3 Implement the Map/Set iterator operations (#2882)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-24 11:18:37 +02:00
Daniella Barsony 6f7dbbce7e Implement Array/TypedArray find index (#2893)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-06-24 11:14:06 +02:00
Robert Fancsik 95650993a2 Container object's properties must be marked during GC. (#2913)
This patch fixes #2895 and fixes #2911.

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-24 11:13:11 +02:00
Robert Fancsik 44b21de7fc Ensure that the constructed object in [[Set]] operation with primitive base cannot be extensible (#2917)
Related part of the standard: https://www.ecma-international.org/ecma-262/5.1/#sec-8.7 1st note.

This patch fixes #2914.

Co-authored-by: Gabor Loki loki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-24 11:12:23 +02:00
Dániel Bátyai cbd41df5eb Module sources should be parsed in strict mode (#2920)
Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-06-24 08:14:34 +02:00
Szilagyi Adam 03202995a0 Add missing release to ecma_op_container_foreach (#2912)
The result of the callback function was not freed
Fixes #2910

Co-authored-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-06-21 19:02:06 +02:00
Robert Fancsik 8b459d9643 Resolve build error after #2888 (#2921)
This patch fixes the build error due to #2888 since this patch has been merged without rebasing to #2903.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-21 15:44:35 +02:00
Szilagyi Adam 7b65167e81 Fix allocation problems when using import and export (#2919)
Construct ecma_string only when there is no parser error using lit_object's index in parser_module_parse_export_caluse and parser_module_parse_import_clause
Fixes #2908

Co-authored-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-06-21 14:21:08 +02:00
Robert Fancsik b707c3f8da Reduce the size of vm_frame_ctx_t. (#2886)
The reference to the previous context is only used by the debugger and the backtrace info,
so this element should not be part of the structure by default.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-21 14:04:24 +02:00
Akos Kiss 78657e667d Make libfuzzer driver properly handle ES2015 test inputs with Promises (#2918)
Not running enqueued jobs (resulting from promises) caused false
alarms (internal assertion failures) at cleanup.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-06-20 09:24:11 +02:00
Gabriel Schulhof 3275c062f8 Improve JS object native pointer unit test (#2915)
After setting a second native pointer, check that both the pointer that
was first set and the second pointer that was set are there.

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2019-06-20 09:09:04 +02:00
Szilagyi Adam 6e9cf4d459 Release operands properly in opfunc_addition (#2909)
Right and left value release wasn't complete
Fixes #2901
Fixes #2902

Co-authored-by: Tibor Dusnoki <tdusnoki@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-06-19 12:29:58 +02:00
Péter Gál 01ecc7bb7b Rework usages/naming of configuration macros [part 2] (#2903)
There are quite a few configuration macros in the project.
As discussed in the #2520 issue there are a few awkward constructs.

Main changes:

* The following macros are now 0/1 switches:
** Renamed CONFIG_ECMA_LCACHE_DISABLE to JERRY_LCACHE.
** Renamed CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE to JERRY_PROPERTY_HASHMAP.
** Renamed CONFIG_DISABLE_UNICODE_CASE_CONVERSION to JERRY_UNICODE_CASE_CONVERSION.
** Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE.
** Renamed JERRY_DISABLE_JS_PARSER to JERRY_PARSER.
** Renamed JERRY_ENABLE_ERROR_MESSAGES to JERRY_ERROR_MESSAGES.
** Renamed JERRY_ENABLE_EXTERNAL_CONTEXT to JERRY_EXTERNAL_CONTEXT.
** Renamed JERRY_ENABLE_LINE_INFO to JERRY_LINE_INFO.
** Renamed JERRY_ENABLE_LOGGING to JERRY_LOGGING.
** Renamed JERRY_ENABLE_SNAPSHOT_EXEC to JERRY_SNAPSHOT_EXEC.
** Renamed JERRY_ENABLE_SNAPSHOT_SAVE to JERRY_SNAPSHOT_SAVE.
** Renamed JERRY_SYSTEM_ALLOCATOR to JERRY_SYSTEM_ALLOCATOR.
** Renamed JERRY_VM_EXEC_STOP to JERRY_VM_EXEC_STOP.
** Renamed JMEM_GC_BEFORE_EACH_ALLOC to JERRY_MEM_GC_BEFORE_EACH_ALLOC.
** Renamed JMEM_STATS to JERRY_MEM_STATS.
** Renamed PARSER_DUMP_BYTE_CODE to JERRY_PARSER_DUMP_BYTE_CODE.
** Renamed REGEXP_DUMP_BYTE_CODE to JERRY_REGEXP_DUMP_BYTE_CODE.
* Recursion check changes:
** Renamed REGEXP_RECURSION_LIMIT to JERRY_REGEXP_RECURSION_LIMIT.
** Renamed VM_RECURSION_LIMIT to JERRY_VM_RECURSION_LIMIT.
* Attribute macro changes:
** Renamed JERRY_CONST_DATA to JERRY_ATTR_CONST_DATA.
** Renamed JERRY_HEAP_SECTION_ATTR to JERRY_ATTR_GLOBAL_HEAP.
  Now the macro can specify any attribute for the global heap object.
* Other macro changes:
** Renamed CONFIG_MEM_HEAP_AREA_SIZE to JERRY_GLOBAL_HEAP_SIZE.
   Then new macro now specify the global heap size in kilobytes.
* Updated documentations to reflect the new macro names.

For more deatils please see jerry-core/config.h.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-06-19 12:28:21 +02:00
Daniella Barsony 985de93d04 Implement String repeat (#2904)
Co-authored-by: Tamas Keri tkeri@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-06-19 12:19:21 +02:00
Akos Kiss 8ee8bc2767 Improve libfuzz integration (#2916)
- Allow command line tools to build together with libfuzzer driver.
  Compile everything with `-fsanitize=fuzzer-no-link` to prevent
  linking in libfuzzers's `main` symbol in all executables (causing
  duplicate symbol errors in command line tools), and add
  `-fsanitize=fuzzer` to the libfuzzer driver only.

- Make ASan optional when building with libfuzzer to allow the user
  to choose freely from available sanitizers (e.g., UBSan, MSan,
  HWASan).

- Stabilize libfuzzer by resetting PRNG seed at every invocation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-06-19 11:34:06 +02:00
Dániel Bátyai 3953fee035 Correctly propagate errors when parsing modules (#2907)
Fixes #2896.

Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-06-14 03:29:26 -04:00
szilagyiadam 351acdf545 Add missing release value call for opfunc_addition (#2899)
Right_value wasn't correctly freed in case of an error.
Fixes #2894
Fixes #2897

Co-authored-by: Tibor Dusnoki <tdusnoki@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2019-06-11 17:42:14 +02:00
Renáta Hodován e2646f93cc Integrate LLVM's libfuzzer engine with JerryScript (#2898)
JerryScript-DCO-1.0-Signed-off-by: Renata Hodovan reni@inf.u-szeged.hu
2019-06-07 14:43:20 +02:00
Robert Fancsik 343e80053b Implement the for of statement (#2871)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-06-07 12:35:42 +02:00
Daniella Barsony b6fc4e13ae Fix rounding issue (#2890)
Fixes #2802

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-05-31 08:31:36 +02:00
Robert Fancsik 076f515d61 Implement the string iterators (#2873)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-30 12:34:19 -04:00
Robert Fancsik 442e482afa Add missing error check for ecma_regexp_exec_helper (#2887)
This patch fixes #2885.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-28 14:22:57 +02:00
Robert Fancsik e1c552ba2e Cleanup unused macros/typedefs from ecma-globals.h (#2888)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-28 10:56:10 +02:00
László Langó 8e39fbc46f Fixed 'C4028' compiler warnings. (#2881)
The formal paramters of some function definitions were different
from the declarations.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-05-21 09:17:10 +02:00
Dániel Bátyai 0ba2d17faf Fix heap limit calculation when using the system allocator. (#2872)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-05-17 11:28:00 +02:00
Dániel Bátyai 9a512c8fcf Properly release property name collection in for-in opcode handler (#2875)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-05-16 15:34:41 +02:00
Dániel Bátyai fd3e982e69 Fix ecma collection header deallocation (#2874)
Collection headers are allocated using the pool allocator, so they
should be freed by it as well.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-05-14 14:10:39 +02:00
Robert Fancsik 76a1fc5674 Support external context in the snapshot tool (#2870)
This patch fixes #2869.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-13 16:07:39 +02:00
Robert Fancsik 4331e39b9a Implement the Set builtin object (#2841)
Also implement the missing iterator initializer part from the Map builtin object constructor.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-10 20:28:43 +02:00
Robert Fancsik 99c7a4040f Super parsing options should be set only in direct eval call (#2863)
This patch fixes #2846.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-10 12:23:29 +02:00
Robert Fancsik 063e7fde2b undefined byteLength should be treated 0 in DataView constructor (#2856)
This patch fixes #2854.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-10 10:47:25 +02:00
Dániel Bátyai 4bdc3a1c46 Implement path normalization in port-default (#2861)
Updated the default port so that it now provides path normalization for
common platforms.

Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-05-09 18:31:58 +02:00
Dániel Bátyai 57f08ee70e Add NuttX specific port implementation. (#2864)
The NuttX target has been problematic for some time, due to the fact
that NuttX apps are built with NuttX's own libc implementation, while
the default-port in JerryScript was compiled with the host libc, which
caused a mismatch between the two.

In order to work around this issue, most of the port implementation is already
duplicated in the NuttX target's jerry_main.c.

This PR adds a NuttX specific port implementation by moving the already
implemented port functions from jerry_main into a separate file, adding
implementation for the missing functions, and disabling the default-port
in JerryScript.

Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-05-09 16:33:25 +02:00
László Langó 0e41311989 Fixed build issues with ES2015 subset profile on Windows. (#2865)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-05-09 16:31:54 +02:00
Robert Fancsik 2d1ad149c1 Fix key iteration in ecma_op_map_foreach (#2855)
This patch fixes #2852 and fixes #2853 as well.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-08 15:21:43 +02:00
Robert Fancsik eb993d57ed DataView object underlying ArrayBuffer should be marked during GC. (#2849)
This patch fixes #2848 and fixes #2850 as well.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-05-08 15:14:21 +02:00
László Langó 372ebd8260 Fixed linker issues of handle scope in jerry-ext on Windows platform. (#2862)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-05-08 11:42:02 +02:00
Dániel Bátyai 3ec6b68063 Clear top module context after local variables have been imported (#2859)
This fixes an assertion failure which was caused by incorrectly importing
the same variables multiple times.

Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-05-06 17:35:33 +02:00
Mate Dabis 3823d2fc81 Fixed typo in parser (#2860)
JerryScript-DCO-1.0-Signed-off-by: Mate Dabis mdabis@inf.u-szeged.hu
2019-05-06 12:57:14 +02:00
Daniella Barsony a2e7816485 Update README (#2844)
Removed Artik053 and updated the links to the measurement site.

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-04-30 15:20:38 +02:00
Dániel Bátyai 1cdb3c6c56 Fix identifier handling inside export statements (#2843)
Fixes #2842

Co-authored-by: Marko Fabo <mfabo@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2019-04-30 10:53:48 +02:00
legendecas 097e1862d2 Set constructor to prototype for ES2015 Classes (#2818)
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
2019-04-29 13:36:23 +02:00
Robert Fancsik 56b6d3a45d Class this binding must be bound to non-heritage contexts as well (#2829)
This patch fixes #2822.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-26 13:34:02 +02:00
Daniel Vince 37b7645e6a Rework ES2015 module system and add missing features. (#2792)
Co-authored-by: Dániel Bátyai <dbatyai@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Daniel Vince vinced@inf.u-szeged.hu
2019-04-25 14:57:17 +02:00
Robert Sipka 938e9c7530 [Debugger] Fixes the processing methods of incoming part messages (#2840)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2019-04-25 13:43:33 +02:00
László Langó 806b9f05c0 Fixed build failure caused by conversion warning with GCC-5.4 (#2839)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-04-25 10:27:52 +02:00
László Langó a6a7d8c7b8 Make the underlying buffer of the ArrayBuffer accessible. (#2836)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-04-24 16:03:56 +02:00
Akos Kiss c4ac67d4af Bump Zephyr target to 1.14.0 (#2837)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-04-24 14:47:58 +02:00
Philippe Coval d3234c2b8c Add STM32F7 support (#2838)
Some flags are not defined because,
they can be deduced from CPU type.

It was tested on NucleoF767ZI running current NuttX master branch.

Change-Id: I68c9787fe3003338228f47fbaf3e7a9522bcd6d5
Forwarded: https://github.com/pando-project/jerryscript/pull/2838
Relate-to: https://github.com/pando-project/libtuv/pull/136
JerryScript-DCO-1.0-Signed-off-by: Philippe Coval p.coval@samsung.com
2019-04-24 14:46:14 +02:00
Robert Fancsik 10d820165d Enable 32bit cpointers by default if the given heap size is greater than 512KB (#2833)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-24 14:41:07 +02:00
Robert Fancsik 6801871161 Super parse options should be cleared before setting it's value (#2831)
This patch fixes #2825.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-24 14:40:09 +02:00
Robert Fancsik 962d549be6 Non-object values should give early false result for instanceof operator (#2830)
This patch fixes #2823.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-24 14:39:04 +02:00
Robert Fancsik 760fc4fb95 Remove incorrect assertions from class construction instructions (#2827)
A class expression can be part of any kind of expression since the asserts for the stack position calculation were incorrect.
This patch fixes #2819.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-24 14:36:19 +02:00
jerry-weng 9d7a0db0dd Add missing jerry_release_value by calling jerry_set_property and jerry_set_property_by_index (#2821)
JerryScript-DCO-1.0-Signed-off-by: jerry-weng jjweng2007@gmail.com
2019-04-18 11:24:27 +02:00
László Langó 5be93dc7f7 Minor fixes of the documentation (#2834)
* Fixed wrong file name indexes in the docs folder.
 * Added description of the logging options into the getting started guide
 * Added missing files to the 'update-webpage.sh' script

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-04-18 10:16:45 +02:00
Robert Fancsik d2931c6e40 Rework Map object (#2760)
This patch reworks the core of the builtin Map object.

Advantages:
 - Provide sublinear access time for the elements via Lcache and property hashmap
 - This implementation is suitable for the builtin Set object as well

Also add the missing 'forEach' routine for the builtin object as well.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-17 14:50:03 +02:00
László Langó bc9efb07a5 Updated the API reference (#2828)
Fixed style issues, fixed inaccurate descriptions and added missing information.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-04-17 11:45:33 +02:00
Robert Fancsik 5c72d995e4 Implement DataView builtin (#2804)
New API functions:
 - jerry_create_dataview
 - jerry_value_is_dataview
 - jerry_get_dataview_buffer

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-16 08:26:39 +02:00
Robert Fancsik b3f4aa6816 Allow the JS objects to have more than one native pointer data (#2814)
Currently JS objects can only have one native pointer data which could be a limitation in special cases.
This patch allows to register multiple native infos, which can be accessed/associated with the corresponding `jerry_object_native_info_t`.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-16 07:50:49 +02:00
Robert Fancsik c818930cdc Use custom dispatcher for Global object's routines (#2794)
Binary size gain:
     - Intel: ~780B (gcc-7.3)
     - Arm: ~450B (arm-linux-gnueabi-gcc-7.3)

The change also contains the renovation of each builtin routine to use early return in case of error to make the code less complicated.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-16 07:48:04 +02:00
lidija-b e944cdaa8b Add endian set for default toolchain (#2808)
When default toolchain is used and architecture not listed in
"#if" in jerry-libm-internal.h on little endian around 90
test-suite tests, 4 unittests and 30 jerry-tests fails depending
on setup tested.
This change checks endians in case no toolchain is found and
sets __LITTLE_ENDIAN macro if it is little endian. This way
it will be set for any future arhitectures using little endian
and architecture that can have both big and little endian not
listed in jerry-libm-internal.h check.

JerryScript-DCO-1.0-Signed-off-by: Lidija Besker lidija.besker@rt-rk.com
2019-04-12 16:32:58 +02:00
Mate Dabis 09d8793e30 Increase branch coverage: Array.prototype functions (#2796)
Added new test cases to improve branch coverage in Array.prototype routines.

The following script is made for testing branch coverage with all the test suites (--jerry-test-suite --test262 --unittests --jerry-tests), or with only one .js file.

https://github.com/matedabis/jerryscript/blob/gcov_coverage_tester/tests/gcov-tests/gcovtester.py

While measuring the branch coverage we dont count JERRY_ASSERT s. The results are measured by running all the test scripts, with the modifications in the PRs.

Branch coverage including pando-project#2682 and pando-project#2674:
	-before: 399 / 476
	-after:  472 / 476

There are 28 functions in ecma-builtin-array-prototype.c, we hit 14 from them.
The other 14 functions are either already covered, or we could not improve the coverage of it.

More information about the coverage improvement and the branches not reached:
https://gist.github.com/matedabis/d7b9fc0690aa2f4be6aa160fdf482e0e

While improving the coverage we found an unnecessary condition check, which can not be false in any cases.

Co-authored-by: Csaba Repasi repasics@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Mate Dabis mdabis@inf.u-szeged.hu
2019-04-12 14:00:44 +02:00
Robert Fancsik 48cec485e1 Identifiers should be stored in the lexical environment if argument object needs to be created (#2816)
This patch fixes #2699.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-12 13:48:02 +02:00
Péter Gál 40f7b1c27f Rework usages/naming of configuration macros [part 1] (#2793)
There are quite a few configuration macros in the project.
As discussed in the #2520 issue there are a few awkward constructs.

Main changes:

* Renamed all CONFIG_DISABLE_<name>_BUILTIN macro to JERRY_BUILTIN_<name> format.
* The special JERRY_BUILTINS macro specifies the basic config for all es5.1 builtins.
* Renamed all CONFIG_DISABLE_ES2015_<name> to JERRY_ES2015_<name> format.
* The special JERRY_ES2015 macro specifies the basic config for all es2015 builtins.
* Renamed UNICODE_CASE_CONVERSION to JERRY_UNICODE_CASE_CONVERSION.
* Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE.
* All options (in this change) can have a value of 0 or 1.
* Renamed ENABLE_REGEXP_STRICT_MODE to JERRY_REGEXP_STRICT_MODE.
  JERRY_REGEXP_STRICT_MODE is set to 0 by default.
* Reworked CONFIG_ECMA_NUMBER_TYPE macro to JERRY_NUMBER_TYPE_FLOAT64 name and now
  it uses the value 1 for 64 bit floating point numbers and 0 for 32 bit floating point
  number.
  By default the 64-bit floating point number mode is enabled.
* All new JERRY_ defines can be used wit the `#if ENABLED (JERRY_...)` construct to
  test if the feature is enabled or not.
* Added/replaced a few config.h includes to correctly propagate the macro values.
* Added sanity checks for each macro to avoid incorrectly set values.
* Updated profile documentation.
* The CMake feature names are not updated at this point.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-04-09 10:14:46 +02:00
Daniella Barsony 722d092528 Add missing port functions for artik053 target (#2811)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2019-04-03 11:20:57 +02:00
László Langó 89cf1a988c Run test262 test suite in both release and debug mode on Travis CI. (#2810)
The CI ran test262 test suite in release mode only to save time.
This patch enables the debug testing on the test suite, which means
the runtime of the "Conformance Tests" job will increase by a few
minutes.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-04-02 20:26:21 +02:00
Robert Fancsik 4b9fee1ba0 Fix typo in the API documentation (#2809)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-04-02 10:13:41 +02:00
Péter Gál 3f6599c358 Add a "single" source/header file generation and build mode (#2790)
Introduce a new way of building: before any file is compiled
all source files are combined into a single C file and all
header files into a single H file (per subdir).

This new approach makes it possible to quickly integrate JerryScript
into other projects:

```
$ gcc -o demo demo.c jerryscript.c jerryscript-port-default.c -lm
```

To use the source generator run:
```
$ cmake -Bbuild_dir -H. -DENABLE_ALL_IN_ONE_SOURCE=ON
$ make -C build_dir generate-single-source
```

This will create the following files in the `build_dir`:
* jerryscript.c
* jerryscript.h
* jerryscript-config.h
* jerryscript-port-default.c
* jerryscript-port-default.h

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-04-01 11:06:13 +02:00
Robert Fancsik e063b8af80 Fix bound functions with no arguments after #2801 (#2805)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-29 12:13:27 +01:00
László Langó 4a67f131bb Fixed typo in README.md of particle target. (#2806)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-03-29 12:09:25 +01:00
Robert Fancsik f23c746b45 Merge external direct magic strings into direct magic strings (#2766)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-29 09:38:54 +01:00
László Langó 6efdb283aa Fixed 'jerry_get_object_keys' API function. (#2807)
'jerry_get_object_keys' always gave back an empty array.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-03-28 19:02:44 +01:00
legendecas 5b29bf6288 Implement handle scope API in jerry-ext (#2753)
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
2019-03-27 14:49:59 +01:00
legendecas 772ab277ea Fixes assertion on calling String builtin with symbol (#2803)
JerryScript-DCO-1.0-Signed-off-by: legendecas legendecas@gmail.com
2019-03-26 16:14:04 +01:00
Robert Sipka 3d656cdf57 [Debugger] Implementation of transport over serial connection (#2800)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2019-03-26 09:39:51 +01:00
Robert Fancsik 0981985134 Remove outer loop from ecma_op_function_call (#2801)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-25 15:11:06 +01:00
Akos Kiss 61a79af8c1 Bump RIOT OS target to 2019.01 (#2786)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-03-22 09:46:19 +01:00
Robert Fancsik 7b23ecc272 Merge base resolve + get/put operations for lexical environments to increase performance (#2798)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-21 09:45:56 +01:00
Daniel Vince 4123f35a3b Part I: Implement ES2015 module system. (#2599)
JerryScript-DCO-1.0-Signed-off-by: Daniel Vince vinced@inf.u-szeged.hu
2019-03-18 16:22:06 +01:00
Robert Sipka 3d3e6fdf58 [Debugger] Create a simplified transmission layer (#2781)
It supports the raw packet sending over a TCP/IP protocol

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2019-03-18 11:00:15 +01:00
Péter Gál fbd734ed28 Split the Travis checks into two test calls (#2797)
The cppcheck can run for quite a long time, sometimes even more than
10 minutes. This change splits the test execution into two part:
* First, do all checks excluding the cppcheck call with the default timeout.
* Second, do the cppcheck call with a 30 minutes maximum timeout.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-03-18 09:32:40 +01:00
wangzhikang123 f3c8eeecb5 Fix the vm stop checking bug (#2795)
when the vm executes VM_OC_LESS operation, the lookahead optimization will cause the by-passing of vm stop checking.
Thus we need to disable the optimization here if JERRY_VM_EXEC_STOP is defined.

JerryScript-DCO-1.0-Signed-off-by: Wang Zhikang wzk0406@mail.ustc.edu.cn
2019-03-13 15:18:35 +01:00
Robert Fancsik 7d48e011c9 Fix getting the iterated object's length property (#2784)
This patch fixes #2782.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-13 13:56:01 +01:00
Péter Gál 162ba8c116 Make jerryx_port_handler_print_char truly a port function (#2789)
In the previous approach `jerryx_port_handler_print_char` was implemented
in by the jerry-default-port. This implementation however required the
jerry-ext handler header file which created a requirement in the
jerry-default-port for the jerry-ext headers.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-03-13 10:19:30 +01:00
Robert Fancsik 90f37a5573 Optimize LCache entrys keys (#2767)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-08 18:46:12 +01:00
Robert Fancsik ea195cd131 Use [[DefineOwnProperty]] in the iterator next step in ecma_builtin_promise_do_all (#2773)
This patch fixes #2770.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-07 08:04:19 +01:00
Robert Fancsik 1fba8901d6 Ensure that Symbol.toStringTag property is copied to buffer as a cesu8 string (#2772)
This path fixes #2769.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-06 18:45:50 +01:00
Robert Fancsik 9c7b96878b Iterated object should be marked during GC (#2785)
This patch fixes #2783

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-06 18:23:57 +01:00
Robert Fancsik dfe7ff8ddb Add missing builtin object type checks from ecma_object_check_class_name_is_object (#2780)
This patch fixes #2779 and the same issue for the Symbol.prototype object, also fixes the check
for the Iterator/ArrayIterator object as well since these checks macro guards were misplaced.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-06 18:18:59 +01:00
Robert Fancsik 2f18b92e0f Fix the rest parameter behavior if the arguments object needs to be created (#2778)
This patch fixes #2777.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-06 18:16:10 +01:00
Robert Fancsik e4fee93b92 Fix the JSON stringify context abort in case of error (#2776)
This patch fixes #2774 and fixes #2775 as well.
Also add a shortcut to access the length of the array in `ecma_builtin_json_array`.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-06 18:11:00 +01:00
Robert Fancsik cedf8e460a Builtin Object constructor should handle symbol arguments (#2771)
This patch fixes #2768.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-03-06 17:12:03 +01:00
Akos Kiss 85e05094e9 Bump NuttX target to 7.28 (#2787)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-03-05 10:14:56 +01:00
Akos Kiss 6cc70d4adc Bump Mbed OS target to 5.11.5 (#2788)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-03-05 09:52:52 +01:00
Robert Sipka 6d490c7296 Separate the debugger-client to support the later usage of other communication protocols (#2764)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2019-02-26 10:56:44 +01:00
Robert Fancsik d4e27d3003 Target arraybuffer's buffer should be absolute addressed in ecma_op_typedarray_set_with_typedarray (#2758)
This patch fixes #2757, also adds a short path for the case when the source and the target typedarrays are the same.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-21 13:24:52 +01:00
wille.io a1fdcf06cb Compile with clang-7.0 (#2754)
jerry_debugger_scope_variable_type_t was not explicitly sized by the compiler as 8bit, accept uint8_t instead (you still can call the fn with a jerry_debugger_scope_variable_type_t)

JerryScript-DCO-1.0-Signed-off-by: wille-io mike@wille.io
2019-02-19 20:23:49 +01:00
Istvan Miklos 9c10d82e4a Fix JSON.stringify (#2759)
There was a wrong check on the property types, it did not check that the
property was name accessor. Also fixed a test case.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2019-02-19 11:29:13 +01:00
Robert Fancsik 60bbd731e5 Add new symbol related API functions. (#2741)
New functions:
 - ecma_create_symbol
 - ecma_value_is_symbol
 - jerry_get_symbol_descriptive_string

Also improve the jerryx_handler_print to be able to print symbol values via using the jerry_get_symbol_descriptive_string API function for symbol values.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-19 07:45:50 +01:00
Robert Fancsik cffb299f37 Ensure that symbol properties can be set via computed object literals (#2747)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-13 18:32:36 +01:00
Robert Fancsik 044b4ea827 Add missing error checks for ecma_regexp_exec_helper (#2756)
This patch fixes #2755.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-13 12:50:01 +01:00
László Langó 2d16705050 Added 'instanceof' binary operation to the API (#2751)
Added 'JERRY_BIN_OP_INSTANCEOF' to 'jerry_binary_operation_t' and
'jerry_binary_operation'. Added unit tests for this new operation
and updated the documentations.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-02-13 12:49:28 +01:00
Robert Fancsik ed0662612d Use custom dispatcher for Array.prototype routines (#2742)
Binary size gain:
 - Intel: ~2.5KB (gcc-7.3)
 - Arm: ~1.2KB (arm-linux-gnueabi-gcc-7.3)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-13 10:46:57 +01:00
Péter Gál f22eea5c6e Allow build artifacts on AppVeyor (#2752)
Enabled the creation of JerryScript Windows binary artifacts during builds.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-02-09 17:01:31 +01:00
Robert Fancsik 4f5ffb4f3a Implement Iterator interface and Array iterators (#2640)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-08 11:10:32 +01:00
Robert Fancsik 2dd854d28b Ensure that ecma_get_number throws error for symbol values. (#2744)
This patch fixes #2743.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-07 16:07:35 +01:00
Robert Fancsik 243e14ac21 Reduce the memory allocations while getting a string's length property (#2736)
This patch reduces the number of string to string object conversion during property managing operations,
via access the length property directly from the string instead of the newly created string object.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-07 16:07:13 +01:00
László Langó 81ccd6a743 Added new 'jerry_binary_operation' API function (#2746)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-02-06 15:40:54 +01:00
Robert Fancsik 5e846c9efa Fix instanceof operator for implicit class constructors (#2748)
Implicit class constructor functions should not be handled as bound functions during [[HasInstance]] check.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-06 15:06:43 +01:00
Robert Fancsik 6b9c924d08 Add recursion limit for VM (#2737)
This patch adds posibility to supervise the VM call stack to avoid aborts/crashes due to the recursion calls.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-01 15:32:26 +01:00
Robert Fancsik 5c1a4f18ea Implement @@toStringTag well-known symbol related features (#2739)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-02-01 14:59:22 +01:00
Robert Fancsik ca8442c523 Add duplicated argument check for function rest parameter (#2740)
Also add a missing word from `PARSER_ERR_FORMAL_PARAM_AFTER_REST_PARAMETER` error message.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-31 14:15:42 +01:00
Robert Fancsik 1ff322b72f Ensure that symbol properties are not listed in ecma_builtin_list_lazy_property_names (#2734)
This patch fixes #2733.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-31 13:42:18 +01:00
Robert Fancsik 924f4bbd74 Fix the order of value finalizing in ecma_builtin_typedarray_prototype_join (#2726)
This patch fixes #2724.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-25 11:03:11 +01:00
Robert Fancsik 4c1ee94652 Add support for function rest parameter (#2647)
ECMAScript v6, 14.1.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-25 09:24:39 +01:00
Robert Fancsik a42f239abb Fix super keyword parsing for arrow functions. (#2664)
This patch fixes #2657.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-22 09:21:28 +01:00
László Langó 858c3e68a1 Fixed unreachable jump statements. (#2722)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-01-22 09:19:33 +01:00
Robert Fancsik 7ed7935084 Add missing ecma_deref_ecma_string call to ecma_builtin_json_object (#2720)
This patch fixes #2719.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-22 01:26:34 +01:00
Robert Fancsik 5becf43ede Fix %TypedArray% object instances symbol properties (#2704)
Add missing check for during property handling for %TypedArray% object since until now only string property names were possible.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-22 01:11:58 +01:00
Robert Fancsik 71608288e6 Substitute symbols with their descriptive string in ecma_raise_standard_error_with_format (#2708)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-22 01:10:42 +01:00
Akos Kiss 2365b4ec35 Fix out-of-bounds writes (buffer overflows) in unit tests (#2714)
Fixes #2711
Fixes #2712

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-21 12:40:27 +01:00
Akos Kiss 936766d241 Bump Tizen RT target to release 2.0 (#2709)
Current build test uses and documentation refers to release 1.1,
however, 2.0 has been out since Oct 2018. This commit bumps the
target to that latest release.

Co-authored-by: Roland Takacs <rtakacs.uszeged@partner.samsung.com>
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-21 12:28:39 +01:00
Akos Kiss 772a88050b Fix buffer overflow while printing unhandled exception (#2710)
Fixes #2675

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-21 12:22:27 +01:00
Akos Kiss 77767c2161 Add pkg-config metadata files for libraries (#2680)
Should core, ext, libm, and/or port libraries be properly installed
on some system, help compilation and linking against them by
providing standard `.pc` files, which can be picked up by
pkg-config.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-21 09:38:05 +01:00
Akos Kiss 67ef396354 Use union to convert between jerryx_arg_int_option_t and uintptr_t (#2718)
This fixes potential out-of-bounds reads in jerry-ext when dealing
with integer argument mappings.

Fixes #2713

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-21 09:29:34 +01:00
Istvan Miklos c23cf4176a Add RegExp recursion depth limit (#2543)
The regexp engine does not have any recursion depth check, thus it can cause problems with various regexps. Added a new build option `--regexp-recursion-limit N` whose
default value is 0, which is for unlimited recursion depth. Also added a build-option-test.

Fixes #2448
Fixes #2190

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2019-01-17 20:16:50 +01:00
Roland Takacs 162e2ddcb6 Use logical operators for bool converions. (#2707)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2019-01-17 14:30:05 +01:00
Roland Takacs 0b3d5edc06 Fix some type conversions in ecma-builtins. (#2706)
Added missing parentheses and explicit type conversions.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2019-01-17 12:50:16 +01:00
Péter Gál 545c6c771b Update the debugger to work on Windows (#2684)
Changed the debugger-tcp.c file to include Windows specific
socket handling code and mode user all components are compilable
for Windows.

Added appveyor configuration to build with and without debugger.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2019-01-17 11:40:29 +01:00
Akos Kiss 7934117625 Bump Mbed target to Mbed OS 5.11.1 (#2695)
The git hash mbed-os.lib was pointing to marked Mbed OS 5.5.5 and
was more than a year old and more than 10.000 commits behind latest
mbed-os master.

This commit forwards the reference to the latest Mbed OS release
(5.11.1).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-17 10:38:02 +01:00
Daniel Vince 243f2ffcad Style fix in the lexer.h (#2705)
JerryScript-DCO-1.0-Signed-off-by: Daniel Vince vinced@inf.u-szeged.hu
2019-01-17 07:50:05 +01:00
Robert Fancsik 86e60ddf8d Fix inner classes in class heritage environment (#2686)
This patch is the proper fix for #2667, since #2269 did not fix the problem entirely.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-16 14:36:54 +01:00
t-harvey cfdb5eddb3 Added the _restore function to "unpop" the argument stack. (#2592)
Added a unit test for the jerryx_arg_js_iterator_restore function.
Added the specification to the documentation.

JerryScript-DCO-1.0-Signed-off-by: Timothy Harvey t-harvey@ti.com
2019-01-16 11:43:36 +01:00
Robert Fancsik 7e3d688e5b Implement the Symbol builtin object (#2601)
This patch contains the base functionalities that the new builtin object requires.

Currently unavailable:
 - print (Symbol('foo')) - this features requires the refactor of the print handler function
 - Several global symbol based builtin routines (follow up patch)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-16 10:09:23 +01:00
Akos Kiss 08c7183ef8 Update slug, org, and project key info for the SonarCloud service (#2690)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-16 16:24:12 +09:00
Kristof Kosztyo 325c426c1e Fix api example in the documentation (#2703)
JerryScript-DCO-1.0-Signed-off-by: Kristof Kosztyo kkristof@inf.u-szeged.hu
2019-01-15 20:21:58 +01:00
Robert Fancsik d716f900e1 Fix getting array length in ecma_builtin_promise_do_{race, all} (#2702)
This patch fixes #2700.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-15 17:31:59 +01:00
Robert Fancsik b4df594d3e Normalize routine's arguments before dispatch (#2687)
Binary size gain:
 - Intel: ~860B (gcc-7.3)
 - Arm: ~660B (arm-linux-gnueabi-gcc-7.3)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-15 16:45:16 +01:00
Akos Kiss a9c3ddff1f Bump NuttX RTOS target to 7.27 (#2696)
Both documentation and travis makefile were referring to NuttX 7.22,
which was released in Sep 2017. This commit bumps the version to the
latest release (7.27, from Nov 2018).

Additionally, it also sets the stlink tool to a fixed (and tagged)
version.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-15 14:02:55 +01:00
Robert Fancsik c305d70b11 Fix "arguments" and "eval" parsing (#2661)
This patch fixes #2656 and fixes #2659 as well.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-15 13:29:56 +01:00
Peter Marki 98aa08e33c Add subdir-level gitignore to the nuttx target directory (#2635)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2019-01-15 11:16:53 +01:00
Robert Fancsik ee267e8aa9 Add missing ecma_deref_ecma_string in ecma_builtin_typedarray_prototype_join (#2701)
This patch fixes #2698.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-15 09:01:33 +01:00
Akos Kiss 9ced3addaa Bump ESP8266 target to SDK v2.1.0 (#2697)
Until now, the ESP8266 target used a non-tagged git hash revision
of the RTOS SDK (from Oct 2017). Moreover, the compiler was also a
custom-built gcc.

This commit sets the RTOS SDK version to v2.1.0, released Oct 2018,
which is the latest old-style SDK for ESP. The commit also changes
the used gcc to an Espressif-provided pre-built toolchain, which is
tagged for the (latest) v3.0.1 SDK release.

(The SDK bump is not to the latest SDK version because the new
v3.x line of the SDK is "ESP-IDF style", which is incompatible with
the current target code base. On the other hand, the toolchain
comes from the latest SDK release because the v2.x line had no
pre-built toolchain suggestions -- but it builds v2.x sources
correctly.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-15 08:35:39 +01:00
Robert Fancsik f02de7a31f Add missing error check in ecma_builtin_promise_do_all (#2694)
This patch fixes #2693.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-14 23:46:01 +01:00
Robert Fancsik 2c031c1220 Implement Object.assign routine (#2678)
Related part of the standard: ECMA-262 v6, 19.1.2.1

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-14 15:04:00 +01:00
Akos Kiss 52fdf4ef3f Travis CI config maintenance (#2683)
- `sudo: false` has been deprecated.
- `install` step is skipped by default for C projects, so there is
  no need setting it explicitly.
- Homebrew addon can be used to install dependencies for OSX jobs
  (and, by experience, it is a lot faster than manually invoking
  brew).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-14 14:45:36 +01:00
Akos Kiss adb80c2045 Update links in docs (#2691)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-11 18:57:30 +09:00
Robert Fancsik 93ec226650 Extract binary lvalue operators (#2630)
This patch substitutes all binary lvalue operators with an assigment + the corresponding binary operator.
E.g. A += (expression) is pasred as A = A + (expression).

Due to this replacement, all the related binary lvalue CBC opcodes can be removed.
Also the arithmetic related VM instructions can put their result directly onto the stack, since no more checking is needed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-10 08:47:45 +01:00
Robert Fancsik e8502fa8cc Fix class extends value (#2662)
This patch fixes #2658 and ensures that when a class extends value is null and the class has no explicit constructor
the proper error is raised during constructing a class instance.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-09 14:27:50 +01:00
Daniel Balla 3ee771655f Fix JerryScript build with clang-6.0 (#2610)
This patch fixes the following error with Clang-6.0

```
jerryscript/jerry-core/api/jerry.c:1527:71: error: implicit conversion loses integer precision:
      'jerry_regexp_flags_t' to 'uint16_t' (aka 'unsigned short') [-Werror,-Wconversion]
  jerry_value_t ret_val = ecma_op_create_regexp_object (ecma_pattern, flags);
```

Also change the `jerry_create_regexp` and `jerry_create_regexp_sz` functions' `flags` parameter to `uint16_t` since the values created with `bitwise inclusive OR` are not part of the enum.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2019-01-09 09:22:47 +01:00
Robert Fancsik 99b968de3c Reduce the memory footprint of 'ecma_instantiate_builtin' (#2646)
This patch introduces a new builtin descriptor table to substitute the generated switch-case structure in 'ecma_instantiate_builtin',
also removes the corresponding helpers functions to simplify the instantiation process.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-09 09:04:21 +01:00
Zsolt Borbély 0c20f8e701 Fix broken links in README (#2679)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2019-01-08 09:59:27 +01:00
Akos Kiss e5fc13f6db Build test disabled jerry-libm (#2681)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-08 09:57:51 +01:00
Robert Fancsik ef2c3b46d7 Fix super property reference parsing (#2672)
`PARSER_CLASS_SUPER_PROP_REFERENCE` flag should be applied for only binary lvalue tokens.
This patch fixed #2671.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-08 09:33:26 +01:00
László Langó 7b48be81c3 Fixed assertion in RegExp built-in. (#2663)
Fixes #2660

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-01-08 09:04:58 +01:00
László Langó 2f8c0a168f Removed ECMA_TRY_CATCH macros from RegExp built-in (#2642)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2019-01-04 15:12:03 +01:00
Akos Kiss f2404ac0e1 Simplify the collection of sources in cmake files (#2673)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-04 08:59:15 +01:00
Robert Fancsik af91072f44 Ensure that ecma_builtin_json_str_helper uses [[DefineOwnProperty]] internal method (#2665)
This patch fixes #2652 and fixes #2653 as well, also reverts #2521.
Related part of the standard ECMAScript v5.1 15.12.3.10.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-03 15:30:22 +01:00
Akos Kiss 1f204de150 Maintenance of fatal code enum (#2670)
- `ERR_SYSCALL` is a legacy that has not been used anymore since
  the removal of jerry-libc. This commit removes it from the port
  API.
- `ERR_DISABLED_BYTE_CODE` is a (relatively) recent addition to the
  fatal code enum. At the time it was added, the documentation has
  not been updated. This commit adds the missing documentation.
  (Plus, it removes a superfluous `JERRY_UNREACHABLE` from after a
  `jerry_fatal (ERR_DISABLED_BYTE_CODE)`.)

Note: As the port API is modified, this is an API-breaking change.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-03 15:27:09 +01:00
Robert Fancsik b80935ba92 Fix ecma_op_resolve_reference_base for super object bound lexical environments (#2668)
All ECMA_LEXICAL_ENVIRONMENT_SUPER_OBJECT_BOUND type lexical environments should return their outer reference during resolving syntactic reference.
This patch fixes #2666.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-03 13:37:01 +01:00
Robert Fancsik 1068b07cbe Ensure that inner classes do not inherit the parent's class HAS_SUPER flag. (#2669)
This patch fixes #2667.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-03 13:36:37 +01:00
Robert Fancsik b69f3fd0ff Add missing error check after vm_op_get_value (#2655)
This patch fixes #2654.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2019-01-02 12:56:02 +01:00
Akos Kiss aae50c9da0 Simplify version key in AppVeyor configuration (#2650)
The format `1.0.{build}` is artificial, the 1.0 prefix has no
meaning, `{build}` is enough.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2019-01-02 10:11:02 +01:00
Robert Fancsik ec142f5ff6 Fix the Map builtin name property (#2648)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-12-19 13:00:54 +01:00
Akos Kiss ae91800e4b Ensure fresh Python 2.7 on Trusty and compatible Intervaltree (#2645)
Recent failures of the Mbed OS target came from two independent
issues:
- some python packages started requiring Python>=2.7.10, and
- the latest Intervaltree 3.0.0 release was released broken.

This patch ensures a fresh python by 'lying' to the CI that this
is a Python project (Python images on the CI come with a recent
interpreter, not with the one shipped as default with the OS), and
locks Intervaltree to a stable version.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-12-17 16:15:14 +01:00
Daniel Balla a1595fa23a Fix possible failure in backtrace info (#2643)
Make sure to ignore static snapshots when sending backtrace information to the debugger.
The `JMEM_SET_NON_NULL_POINTER` macro requires the frame context's `bytecode_header_p` pointer to be a heap pointer, but due to the static snapshot it might not be, causing an assertion failure.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-12-17 00:17:11 +01:00
Akos Kiss 5779a5b8a8 Fix MbedOS build (#2644)
Since recently, the newly released mbed-host-tests 1.4.4 gets
installed during the python requirement installation step. That
package requires pyocd>=0.14.0, which cannot be satisfied for
whatever reason. This quick fix pins mbed-host-tests to version
1.4.2, which does not have unsatisfiable requirements.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-12-14 18:08:32 +01:00
Akos Kiss 8ed5078e96 Rewrite debugger test runner to use portable redirect-and-append notation (#2641)
The test runner used `&>>` to channel stderr to stdout and append
all that to a file. However, that's Bash 4 syntax, which is not
available everywhere, e.g., on MacOS. Bash pre-4 syntax requires
the classic `>>file 2>&1` notation.

This commit rewrites the test runner to use the portable syntax.
Moreover, it also rewrites `&>` to `>file 2>&1` for the sake of
consistency.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-12-14 12:54:46 +01:00
László Langó 9b24bde4c6 Fixed connection lost of debugging sessions. (#2636)
The peek of the socket does not work on other platforms,
beacause the errno is not set correctly. The code path
added by #2427 Linux specific, so it has been guarded
to solve connection lost issues during debugging sessions
when the client does not send data but still connected.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-12-12 15:41:42 +01:00
Robert Sipka 93e71150fe Update the storage locations of the status badges (#2639)
The name of the database has been changed to jsremote-testrunner from remote-testrunner

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2018-12-12 13:43:26 +01:00
Zoltan Herczeg 83ee9cfca3 Fix named function expression creation. (#2634)
Create a local lexical environment with the name of the function. While
this is not too memory efficient, some corner cases requires its existence.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-12-12 12:50:03 +01:00
Robert Fancsik 4f0b075f85 Implement ES2015 {Array, %TypedArray%}.prototype.find routine (#2631)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-12-12 10:13:05 +01:00
Daniel Balla c6a2fd5d3d Fix an issue while debugging with static snapshots (#2606)
The issue was found when debugging IoT.js with static snapshots turned on, if an error was thrown an assertion failure was caused. The reason is the frame context's bytecode_header_p pointer was not a heap pointer. The jerry_debugger_breakpoint_hit function tries to set a compressed pointer which points to bytecode_header_p with the JMEM_CP_SET_NON_NULL_POINTER macro, which has an assertion that requires the above mentioned bytecode_header_p to be a heap pointer, which is obviously not.


Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-12-11 18:51:00 +01:00
Robert Fancsik 101f62ce9d Improve the vm_loop suspending for exec operations (#2589)
Exec operations{call, construct, super_call} related bytecode sequences no longer executed twice.
The execution continues with the next opcode or a specific bytecode sequence if an error occurs during the operation.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-12-06 15:36:26 +01:00
Robert Fancsik 79b2df124e Separate VM_OC_PROP_GET to a single operation in vm_loop (#2607)
VM_OC_PROP_GET is the general vm instruction for getting an object's property.
This opcode can be mutated into several other opcodes depending on the context (pre- post increment, ident reference).
Since these mutated opcodes perform additional checks and VM_OC_PROP_GET is a highly frequent instruction and it is worth to introduce a special case for it.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-12-06 14:31:30 +01:00
Roland Takacs 3f9dd0f1f9 Use Thumb instructions on TizenRT. (#2629)
In order to decrease the binary size of JerryScript, enabled the Thumb
instruction set that is supported on ARM Cortex-R series processors.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-12-02 09:56:27 +01:00
Zoltan Herczeg bc1b13dcb6 Fix floating number parsing. (#2628)
This patches fixes floating point number parsing when the number starts with dot.

Fixes #2614.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-12-01 17:22:39 +01:00
László Langó a08291eb12 Unify the usage of boolean value creations. (#2623)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-11-30 11:33:30 +01:00
Robert Fancsik 6dfa4efbfb Remove unnecessary check from VM_OC_NOT (#2622)
This patch removes the ECMA_IS_VALUE_ERROR check from VM_OC_NOT, since the general toBoolean operation cannot throw an exception.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-30 07:45:48 +01:00
Robert Fancsik 24817b27f9 Optimize property call opcodes (#2609)
In with contexts the object base value must be resolved before executing a call operation.
Since this happens rarely the base resolving code paths has been seperated to an other VM opcode
so these extra checks do not burden the general property call steps.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-29 09:00:22 +01:00
Robert Fancsik e11c499b4b Reduce ecma_{ref, deref}_object calls while using ecma_builtin_get (#2616)
The following stucture was highly frequented in the code base:

 - Get a builtin object // This operation increases the reference count of the object
 - Use it for create a new object
 - Deref the builtin object

After a builtin has been instantiated there is always at least one reference to "keep it alive",
so increase/decrease the reference count for getting the value only is unnecessary.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-28 20:23:21 +01:00
Tóth Béla 8410570dd9 Seperate tests from test-api.c - Property (#2596)
Seperate the property based test from the `test-api.c` file.

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2018-11-28 13:13:24 +01:00
Roland Takacs 5151f9161f Use logical operators for bool converions. (#2620)
The explicit boolean type conversion (introduced by #2575) desn't work
with TizenRT if custom boolean representation is used. Of course,
TizenRT gives an opportunity to use the C99 standard boolean (that works
well if that is set).

I've replaced all the explicit boolean type conversions with double
negations that helps to work JerryScript well with custom boolean types.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-11-28 11:35:12 +01:00
Akos Kiss 17178ec185 Make CONFIG_ECMA_LCACHE_DISABLE and CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE build-tested (#2615)
Because these feature guards don't have their counterpart options in cmake, they
seem to be less tested. This commit makes them build-tested at least.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-11-28 09:40:54 +01:00
Csaba Repasi 5533b8ba9b Add new tests (#2578)
Added tests/jerry/unusual.js to test corner cases
Added tests/jerry-test-suite/11/11.08/11.08.06/11.08.06-008.js (a new test of instanceof)
Added new floatingpoint test case to tests/jerry/arithmetics-2.js
Added new test case to tests/jerry/arithmetics-bignums.js

JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2018-11-22 10:10:37 +01:00
Zoltan Herczeg a0a6eaaee8 Support identifier references for object initializers. (#2597)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-11-22 10:07:11 +01:00
Daniel Balla 3d33d3258a Rename a regression test to match the issue number (#2613)
There was a typo in a regression test name, referencing to a different pull request rather than the issue it fixes.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-11-22 02:24:48 +01:00
Robert Fancsik 8e28316b1a Fix a typo in Object.getOwnPropertyNames test (#2612)
With the change the test file truly checks the corresponding part of the standard (ECMAScript v5, 15.2.3.4.1).

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-22 02:08:06 +01:00
Daniel Balla f9e21540d6 Typo fixes related to jerry_json_stringify (#2611)
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-11-22 02:05:34 +01:00
Renáta Hodován c87aa83b0d Skip -m32 build-test on non-Linux non-x86 platforms (#2558)
The `-m32/64` compiler flags are x86/64-specific (mostly; at least in the
context of JerryScript-supported architectures) and macOS has deprecated 32-bit
support, so it's better to keep the build-testing of `-m32` to x86[-64]/Linux
only.

JerryScript-DCO-1.0-Signed-off-by: Renata Hodovan reni@inf.u-szeged.hu
2018-11-21 20:15:45 +01:00
Marko Fabo 22b08518c7 target: mbedos5: Modify generate_pins.py (#2524)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2018-11-20 14:53:19 +01:00
Robert Fancsik 49a0836daa Add missing ecma_free_value in ecma_builtin_promise_do_all (#2604)
This patch fixes #2602 and fixes #2603 as well.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-20 14:40:34 +01:00
Daniel Balla 704eb45cb8 [API] Add RegExp C API (#2542)
This patch supports creating a RegExp object through the C API.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-11-19 13:18:00 +01:00
Robert Sipka 47fa5904b1 Improve the evaluate requests (#2583)
Currently it evaluates the given expression in the context of the top most stack frame.
The expression should access to any variables and arguments that are in the scope chain.
Implement the eval_at request with the level of the scope chain as a further argument.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2018-11-15 15:53:10 +01:00
Robert Sipka 6c4b316609 [Debugger] Modify the object representation in case of variables request. (#2594)
Return with the object`s toString() method instead of create a json formated string from it.
It could have led to an error in previous cases (an object contains itself etc.)

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2018-11-15 14:13:49 +01:00
Robert Fancsik 9535a230ba Reduce the argument count of ecma_op_object_get_property_names (#2598)
Introduce ECMA_LIST_ARRAY_INDICES[_ENUMBERABLE[_PROTOTYPE]] flags instead of passing 3 boolean arguments.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-15 13:40:44 +01:00
Ádám Kallai ba8e144f7b docs: Fix jerry_get_property API example (#2590)
The first paramter of the function should be 'global_object' instead of obj_val
in this case.

JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2018-11-13 13:30:59 +01:00
Ádám Kallai 8219595c2d targets: Speculative workaround for Zephry Travis CI (#2595)
The latest version of Pyocd does not install on Linux,
in Zephry master branch the version was locked to 0.12.0 in requirements.txt.
It's temporary workaround to fix Travis CI for Zephry v1.13.0.

JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2018-11-13 13:15:05 +01:00
Robert Fancsik ecf385888f Disable class Array/%TypedArray%.prototype.{slice, map, concat, filter, splice} related tests (#2588)
This patch fixes #2587.
The reason of disabling these tests is that the current implementation slightly differs from the related part of the standard (ECMA-262 v6, 9.4.2.3.6.d.1).
This part requires the hidden Symbol.@@species property, hence this functionality has not been implemented yet in the project.
Also add the related test case to prevent further errors.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-09 09:42:16 +01:00
Robert Fancsik 1fc369e493 Use binary search for keyword checking (#2584)
This patch improves keyword searching during identifier parsing.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-08 10:24:53 +01:00
László Langó 7f17210d98 Added missing include for debugger build. (#2586)
In certain platforms the explicit include of 'sys/socket.h' is needed,
e.g.: TizenRT.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-11-06 18:15:27 +01:00
Robert Fancsik 3faec79071 Reduce ecma_builtin_helper_def_prop arguments (#2585)
This patch uses the ECMA_PROPERTY_CONFIGURABLE[_ENUMERABLE_[WRITABLE]] marco to pass the options instead of using 3 boolean arguments for it.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-11-06 18:13:38 +01:00
matedabis 74d474248d Enable the already fixed test cases (#2570)
Enable already fixed asserts

JerryScript-DCO-1.0-Signed-off-by: Mate Dabis mdabis@inf.u-szeged.hu
2018-10-31 09:53:21 +01:00
repasics 3c1d0e6100 Enable test cases (#2566)
Enable previously disabled test cases in math-pow.js. Everything works as expected.

JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2018-10-30 15:25:54 +01:00
Tóth Béla 63e8287f2b Seperate tests from test-api.c - Strings (#2564)
`test-api.c` is contains testing for all API functions. This file is too big and hard to read. This patch moves the strings and string methods into a separate test file.

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2018-10-30 11:42:54 +01:00
Zoltan Herczeg 83fc0aa04f Add support for function argument initializers. (#2571)
EcmaScript 2015 14.1.

Note: arrow functions with default arguments are not supported yet.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-10-30 10:48:35 +01:00
Akos Kiss aeddb1cd88 Get rid of ? true : false (#2575)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-10-29 14:51:59 +01:00
Robert Sipka 34c5e229ee List scope chain levels and their variables to the selected stack frame. (#2557)
It supports to list the scope chain of the current execution context and see
which variables are available.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2018-10-29 14:33:31 +01:00
Akos Kiss 7120b8ec02 Improve .travis.yml (#2577)
- Use builtin support of Travis CI for job names instead of using
  a custom environment variable for the same purpose.
- Use `skip` in `script` and `install` steps instead of `true`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-10-29 13:37:19 +01:00
Zoltan Herczeg 93567fbb8f Support methods for object initializers. (#2567)
MethodDefinition in ES-2015 12.2.6.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-10-26 23:47:08 +02:00
Roland Takacs ffbd6e6c5c Fix type conversion errors in case of TizenRT. (#2572)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-10-26 14:21:00 +02:00
Robert Fancsik d1860d0e34 Implement ES2015 class feature (part II.) (#2439)
This patch is the second milestone of the implementation of this new language element.

Supported:
 - Single class inheritance
 - Functionality of 'super' keyword
 - Implicit constructor in class heritage
 - Specific behaviour while extending with the built-in 'Array' or '%TypedArray%' object
 - Abstract subclasses (Mix-ins)

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-10-25 16:00:48 +02:00
Zoltan Herczeg e0e6363f85 Fix object initializer prescanning issues. (#2563)
This patch fixes incorrect syntax errors reported by the prescanner for
ES5.1 getter/setter property initializers and ES2015 computed properties.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-10-19 13:49:41 +02:00
Tóth Béla f8f691deb1 Move version numbers to public headers (#2556)
JERRY_SNAPSHOT_VERSION and JERRY_DEBUGGER_VERSION were moved into public headers, to grant access to them.

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2018-10-19 11:49:53 +02:00
Zoltan Herczeg 5060579b90 Fix double literal free. (#2535)
Fixes #2531.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-10-18 01:17:53 +02:00
crazy2be 3afc4b0b85 Change jerry_port interface to allow for a correct implementation of timezones. (#2540)
The previous jerry_port interface did not allow timezones to be handled correctly,
even if the host system was up to the task. This PR changes the jerry_port interface
to allow a completely correct implementation to exist, and provides one (for Linux/BSD
systems) in default-date.c.

Fixes #1661

JerryScript-DCO-1.0-Signed-off-by: crazy2be crazy1be@gmail.com
2018-10-18 00:58:18 +02:00
crazy2be 9ab33e86d3 Add some progress printing to the test262 tests (#2559)
Previously, these would run for several minutes without printing
any progress. Now, at least print the number of tests executed.

JerryScript-DCO-1.0-Signed-off-by: crazy2be crazy1be@gmail.com
2018-10-15 08:22:29 +02:00
Akos Kiss afe2a80431 Ensure that tests are always executed in a proper time zone (#2551)
The America/Los_Angeles time zone is already enforced for test262
Travis CI jobs but that doesn't guarantee the correctness of
locally executed tests. So, this patch moves the setting of the
`TZ` environment variable from `.travis.yml` to `run-tests.py`.

The date-related tests in the jerry test suite also rely on a time
zone (UTC). Thus, `TZ` is forced for those tests, too.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-10-09 11:43:07 +02:00
Akos Kiss 1393e9c3da Remove the support for "N*.js"-named disabled tests (#2553)
The only such test was a legacy of the long removed compact
profile, which is also removed.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-10-08 13:48:39 +02:00
Akos Kiss a9c6364bce Fix mismatch in context getter/setter names of default port (#2554)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-10-08 13:48:23 +02:00
Akos Kiss 4a0dd587fc Fix documentation of jerryx_handler_assert (#2555)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-10-08 13:48:09 +02:00
Roland Takacs 1302887498 Remove the JERRY_SNAPSHOT_FOUR_BYTE_CPOINTER snapshot flag. (#2550)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-10-05 09:55:37 +02:00
Zoltan Herczeg d5a635a54a Fix use after free during creation of Promise reactions. (#2532)
The ecma_enqueue_promise_reaction_job() function allocates memory,
which might trigger a GC run. During this GC the objects in the
reactions collection are not marked.

Fixes #2486.
Fixes #2506.
Fixes #2541.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-10-05 08:08:41 +02:00
Zsolt Borbély 48810a9d88 Add missing doc to webpage generator script (#2548)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2018-10-04 10:59:30 +02:00
Zoltan Herczeg a8399f4416 Rework op_construct. (#2547)
The new form should be more suitable for classes.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-10-03 11:52:01 +02:00
Robert Fancsik abf22597e5 Add missing error check in ecma_builtin_promise_do_race (#2546)
Fixes #2544.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-10-03 11:39:43 +02:00
Daniel Vince e12d015bd2 Fix typo in the byte code documentation. (#2545)
JerryScript-DCO-1.0-Signed-off-by: Daniel Vince vinced@inf.u-szeged.hu
2018-10-01 12:19:42 +02:00
Daniel Balla 7717d2ee27 Change Promise properties to internal properties (#2526)
There was an issue in the Promise implementation where properties were accessible from JavaScript.
ie. `Object.defineProperty(Object.prototype, 0, {})` could modify properties which should've been inaccessible.
The reason behind that is somewhat interesting as 0-7 were the same values as the enum values in the property list of the Promise object.
Changing these properties to internal, makes them inaccessible from JS side.

Also some tests have been changed, namely 2490 and 2465.
The 2490 one got renamed, and all of the testcases from the issue have been added.
2465 got changed as well, since currently our Promise implementation can't display Promise errors, so we should check if an error is correctly returned.

Fixes #2490

Co-authored-by: Robert Fancsik <frobert@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-09-24 13:49:41 +02:00
László Langó d08b46d15a Fix '--skip-list' argument of the test runner script. (#2536)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-09-24 13:17:04 +02:00
Daniel Balla 0523278a98 Fix not checking errno after calling recv() (#2538)
There was an issue not checking if recv() set the error value to EWOULDBLOCK or EAGAIN (both equals 11).
If recv() returns 0 that means the connection was gracefully closed from the other side. However, if you are using non-blocking sockets, and recv() returns 0, but sets the errno to EWOULDBLOCK or EAGAIN it means the socket operation would block.
This patch fixes #2537

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-09-24 09:21:35 +02:00
Zoltan Herczeg 35fbcd1ffd Increase the debugger version field size from 1 byte to 4 byte (#2513)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-09-20 09:33:56 +02:00
László Langó df69e1e08b Add more consts to external magic strings to get data moved from .data to .rodata. (#2534)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-09-20 09:17:58 +02:00
László Langó 81810d58f8 Fix memory leak in the snapshot creation. (#2533)
Bytecode must be freed when the source is parsed succesfully,
but the snapshot generating fails for some other reason.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-09-19 20:47:16 +02:00
Akos Kiss cfa7cfc08c Add soft assert handler to jerry-ext (#2516)
Allow developers to choose whether they want a hard or a soft
implementation behind `assert`, i.e., whether they want to kill
the whole engine in case of an assertion failure in the executed
script or just throw a JS error.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-18 14:42:28 +02:00
Robert Fancsik 685d8b3675 Fix JERRY_CONTEXT (error_value) handling during ecma_builtin_promise_reject_abrupt (#2519)
Fixes #2489.

Co-authored-by: Daniel Balla <dballa@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-09-17 18:27:00 +02:00
Akos Kiss b97f5ffca0 Send print output to debugger client from the port implementation (#2515)
... not from the print handler extension. The sending of logs is
already in the port implementation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-17 18:17:16 +02:00
Zoltan Herczeg 3031a11f86 Fix LCache invalidation issue for native properties during GC. (#2530)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-09-17 17:31:50 +02:00
Robert Fancsik 6c21c08b0e Fix ecma_op_function_list_lazy_property_names in case of arrow function (#2529)
Fixes #2528.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-09-17 13:31:17 +02:00
Akos Kiss 3d3a8008a8 Don't use strlen for string literals (#2517)
Their length (size) is known at compile time. Therefore `sizeof`
is more efficient for them.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-17 10:07:24 +02:00
Tóth Béla 2d83d8ed17 Fix check-magic-strings.sh to return with non-zero if error happens (#2525)
Running `tools/run_tests.py --check-magic-strings` causes an IndexError,
but the script exits with 0, indicating error-less run.
Added error checking to the file, to indicate errors in the future.

Fixes #2522

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2018-09-14 13:37:48 +02:00
Peter Marki 0d05dfcd68 Remove bad assertion in ecma_builtin_json_str_helper (#2521)
Fixes #2494

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2018-09-14 12:04:47 +02:00
Tóth Béla 08e4a95394 Update regular expressions in gen-magic-strings.py (#2527)
In their past form, they could not recognize preprocessor directives,
if they didn't start on column 0. Updated them to fix this problem.

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2018-09-14 08:22:35 +02:00
Akos Kiss f114f83720 Remove the JERRY_GET_CURRENT_CONTEXT macro (#2512)
It was an unused and undocumented macro that enabled diverting the
`jerry_port_get_current_context` calls, an approach that was not
used anywhere else in the Port API.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-13 14:18:47 +02:00
Akos Kiss 4ec607a58b Remove leading space from before #ifs (#2523)
It both is against coding style and confuses the
`gen-magic-strings.py` build tool.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-12 15:00:05 +02:00
Paul Sokolovsky 5472aff0dc targets: zephyr: Update for Zephyr 1.13 and SDK 0.9.3 (#2497)
Zephyr 1.13 made some refactorings to its CMake infrastructure which must
be propagated to applications.

Also, some config options were removed/refactored, so cleanup prj.conf.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2018-09-11 15:13:07 +02:00
Akos Kiss 7825e4756a Properly guard off LCache-related functionality (#2511)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-10 13:27:39 +02:00
Daniel Balla 8f64339e5f Fix ecma_op_object_put return value not being handled (#2514)
Fixes #2487
Fixes #2488

Co-authored-by: Robert Fancsik frobert@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-09-06 21:05:37 +02:00
László Langó 99c9a22b78 Improve API of literal save and the snapshot (command line) tool (#2507)
Removed 'jerry_parse_and_save_literals' and introduced
'jerry_get_literals_from_snapshot' instead which works
on snapshot buffers rather than source code. Added literal
saving feature to snapshot merge in the snapshot command
line tool. Also added missing 'jerry_cleanup()' calls to the
snapshot tool. Improved the console messages of the snapshot
tool.

Based on previous work of Tamas Zakor <ztamas@inf.u-szeged.hu>

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-09-06 13:45:15 +02:00
Akos Kiss 054717fd29 Promote dynamic memory management from debugger transport to core API (#2503)
Under the cover of the debugger transport layer, allocation on the
engine's heap has been made available to the public. As there are
actually no restrictions on what the allocated memory can be used
for, the memory management functions better fit in the core part
of the API.

Closes #1805

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-04 16:31:26 +02:00
Zoltan Herczeg 0a40f55e5f Introducing internal properties. (#2485)
Native handle and pointer are moved to internal properties.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-09-04 15:43:35 +02:00
Akos Kiss 30b7a72344 Merge instance into context (#2501)
There was quite some confusion about terminology around instances
and contexts. All the docs mentioned external contexts but
functions and types were referring to instances, and the relation
between these two concepts were not clear. This commit keeps
(external) context as the only surviving concept.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-04 13:56:49 +02:00
Zoltan Herczeg d3d42f7685 Implement the core of the map object. (#2447)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-09-04 13:30:00 +02:00
Daniel Balla 65e81f3262 Fix UTF8 string length calculation (#2508)
Fixes #2451
Fixes #2452
Fixes #2453

Co-authored-by: Robert Fancsik <frobert@inf.u-szeged.hu>
JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-09-04 10:47:28 +02:00
Akos Kiss b934dd8308 Fixup JMEM_HEAP_STAT_xxx definitions (#2509)
- Get the macro definition indentations right.
- Define some of the macros only if system allocator is not in use.
- Ensure that macros with arguments don't cause unused variable
  warnings even if memory statistics is disabled.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-04 10:24:24 +02:00
Daniella Barsony 9ea9061aa2 Fix run-test-suite (#2505)
You could not interrupt the test with Ctrl+C

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2018-09-04 10:23:59 +02:00
László Langó 8547380d46 Fix constantness of 'jerry_merge_snapshots' function. (#2504)
'jerry_merge_snapshots' should not modify the input snapshots. Updated the
related unit test. Also fixed some minor style issues.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-09-03 14:00:07 +02:00
Zoltan Herczeg 2ad883ea48 Fix logging issues in the debugger. (#2483)
- Properly handle logging during transport close
 - Properly display data during parse

Furthermore hide global functions of the debugger.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-09-03 11:14:57 +02:00
Akos Kiss d270f82ecb Clean up memory statistics printing functions (#2502)
- Remove leftover declaration of `jmem_pools_stats_print`.
- Remove unnecessary trampoline function `jmem_stats_print`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-09-03 09:21:21 +02:00
Daniel Balla f5757e4c91 Fix ecma_builtin_promise_race_or_all function (#2491)
If a new Capability was created no check was issued if it happened to be an error.
Fixes #2465
Fixes #2468
Also fixes the second variant of #2490.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-08-31 16:45:32 +02:00
Akos Kiss c3b6bfe8b6 Reorganize heap context related elements (#2500)
- Moved global context's `JMEM_HEAP_SIZE` to jcontext.h as external
  context's heap size is declared there, too.
- Moved the assert on `jmem_heap_t` vs `JMEM_HEAP_SIZE` to jcontext.c,
  as both entities are declared in the corresponding header.
- Removed superfluous checks on `JMEM_HEAP_SIZE` as it is not a
  publicly configurable macro (opposed to `CONFIG_MEM_HEAP_AREA_SIZE`).
- Ensured that all definitions of and references to `jmem_heap_t`,
  `JERRY_HEAP_CONTEXT`, `JERRY_HEAP_SIZE`, and `JERRY_HEAP_AREA_SIZE`
  are guarded by `#ifndef JERRY_SYSTEM_ALLOCATOR`, as they are
  meaningless if the system allocator is used.

The commit also contains some stylistic changes in jcontext.h

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-31 14:58:11 +02:00
Akos Kiss 6049c0378d Merge lcache into context (#2498)
It is superfluous to maintain multiple globals when the whole
reason of context is to keep them in a single place. It also
simplifies initialization and external context creation a bit.

Also removed unused lcache header includes.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-31 13:10:37 +02:00
Akos Kiss a2645601ae Remove character pointer typedefs (#2492)
The `[jerry|ecma]_char_ptr_t` types are some old legacy that are
used quite inconsistently. Their `[jerry|ecma]_char_t *` variants
are used a lot more often, so it's better to stick to one form
throughout the code base.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-30 09:33:05 +02:00
László Langó df1893042d Added missing documentation of JerryScript instances to the API reference. (#2482)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-08-30 09:25:11 +02:00
Zoltan Herczeg 7d41d38e3c Remove deprecated native handle support. (#2496)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-08-29 12:51:37 +02:00
Akos Kiss b4dc6b0cbe Change jerry_debugger_send_{output,log} to take const jerry_char_t * (#2495)
... instead of `jerry_char_t []`, which is not used anywhere else
in the API.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-29 15:53:11 +09:00
Akos Kiss fa5c361774 Move the 'init/fini arrays' build option to jerry-ext (#2493)
Since the removal of jerry-libc, only jerry-ext uses the
`FEATURE_INIT_FINI` optional feature. Thus, it's better to move it
from the global cmakelists to that of jerry-ext.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-29 08:39:59 +02:00
Zoltan Herczeg 25f1718d84 Move some internal functions into JerryDebugger. (#2484)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-08-28 23:56:57 +02:00
Zoltan Herczeg bd42403600 Implement computed properties for object literals. (#2481)
Also disable ES5.1 property name dumplication checks
when ES2015 object literals are enabled.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-08-28 15:28:16 +02:00
Zoltan Herczeg 300e40ba9d Improve python debugger client. (#2441)
Replace DisplayData to DebuggerAction. The new class has only four type
options. Furthermore several functions returning with DisplayData is
changed to return with string.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-08-22 17:34:32 +02:00
Anthony Calandra b2cf7eb659 Add %TypedArray%.prototype.sort([ compareFunction ]) support. (#2437)
JerryScript-DCO-1.0-Signed-off-by: Anthony Calandra anthony@anthony-calandra.com
2018-08-22 08:49:12 +02:00
Akos Kiss 6e94414f9c Align the RIOT target with the clang build of RIOT OS (#2477)
This means cross building with clang and using short enums. Also
bump RIOT OS version to latest 2018.07.

Note: On Travis CI, clang-3.9 is used for testing. That version is
widely available, from Ubuntu 14.04 to 18.04.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-21 10:46:45 +02:00
Akos Kiss f6ccdbdddd Doctest debugger examples and fix revealed issues (#2475)
This will help to keep the debugger documentation up to date.
(Note: only compilation & linking is possible as execution would
require a connecting debugger client, which is not supported for
unit/doctests.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-21 09:42:56 +02:00
Akos Kiss 7639e613a4 Remove jerry-libc (#2332)
Rationale:
- There is no port under targets/ that would use it. All of them
  turn it off when building.
- That's no surprise, as jerry-libc supports no barebone MCUs but
  posix targets with syscalls only. Actually, that's Linux only,
  because macOS builds have turned off the use of jerry-libc a
  while ago.
- And there is no point in maintaining a highly restricted set of
  libc functions: as soon as someone wants to use JerryScript in a
  scenario that needs more functions than jerry-main, they have to
  choose a different libc (most problably the compiler's default
  one).

I think that we should not keep supporting an otherwise unused
library for the purposes of jerry-main on arm/x86/x64-linux  only.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-21 09:26:53 +02:00
Martine Lenders 851f4f0b89 Fix LLVM/clang conversion errors (#2473)
This fixes some conversion errors one gets when compiling with
LLVM/clang. Most of them are caused when a bit-specific type (i.e.
`uint16_t`) is implicitly cast to an `enum` of smaller value range.

The fix is just an explicit casting of those types to the desired target
type.

JerryScript-DCO-1.0-Signed-off-by: Martine Lenders m.lenders@fu-berlin.de
2018-08-21 08:22:57 +02:00
Robert Fancsik 505dace719 Add a validation before evaluating the source code (#2480)
This patch checks whether the source code is a valid UTF-8 string before evaluating it in prompt mode.
Also fixes #2476.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-08-21 13:53:56 +09:00
Marc Jessome cffeaba2a6 Fix syntax error when closing a block after a return statement (#2479)
This adds a right brace to the list of tokens that will end a return
statement.

JerryScript-DCO-1.0-Signed-off-by: Marc Jessome marc.jessome@fitbit.com
2018-08-21 13:51:40 +09:00
Zoltan Herczeg 767dd68ce1 Change literal status flags to enum. (#2474)
Also fix a white space typo.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-08-18 08:06:37 +02:00
Akos Kiss 4e58ccf680 Update debugger documentation (#2471)
The documentation has not been updated when the HTML client got
removed nor when the new transport layer replaced the previous
debug server initialization process.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-16 07:59:12 +09:00
Akos Kiss b52fff1f9d Distinguish between public and private headers in jerry-core (#2472)
The patch also ensures that all components access only the public
headers of other components (except for unit tests, which are
allowed to use private headers, too).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-16 07:55:38 +09:00
Akos Kiss a3112ab901 Split string-sending debugger API into output- and log-sending functions (#2461)
This helps to avoid the use of non-public headers and
protocol-internal constants in external code (e.g., in jerry-port
and jerry-ext).

The patch also cleans up the necessary includes in jerry-core public
headers, and the include order in jerry-port/default public headers.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-14 16:29:06 +09:00
Akos Kiss b9aa0da402 Fix unpacking mismatch in run-tests.py (#2466)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-14 08:25:13 +02:00
Akos Kiss 990b5d24dd Fix include directories of jerry-ext (#2464)
The distinction between public and private include directories was
not maintained and the install paths got confusing.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-13 13:02:10 +09:00
Akos Kiss b31e43075a Add explicit casts to enum-to-integer conversions (#2467)
Clang 6 is more picky about implicit conversions and complains
about loss of presicion and/or change of signedness.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-13 13:01:37 +09:00
Akos Kiss d7cb48d4cc Rename debugger-ws.h to debugger-sha1.h in debugger extension (#2463)
The renamed header doesn't contain any declarations related to
debugger-ws.c but contains the declaration of a function from
debugger-sha1.c.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-13 12:43:36 +09:00
Akos Kiss 79d1a3cc7e Fix FILE_PATTERNS of Doxyfile and some of the issues it was hiding (#2446)
`FILE_PATTERNS` is a space-separated list, in contrary to what is
suggested by its documentation. The pattern `*.h, *.c` does not
match header files but files with `.h,` extension only. Rewriting
the current comma-separated pattern makes Doxygen actually process
header files. However, it also reveals several hitherto hidden
issues (mostly missing documentation) in the code. This patch fixes
some of these documentation problems (and lists the files with
outstanding issues in a 'backlog').

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-13 12:42:19 +09:00
Akos Kiss 29e7330b9b Move all (nano|u)sleep-related decisions to default port implementation (#2462)
... where they belong.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-11 00:06:25 +02:00
Akos Kiss fb35e34801 Make string constants const char * const (#2458)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-10 21:08:49 +02:00
yangfasheng 81f37cf134 Modify header file contains. (#2460)
JerryScript-DCO-1.0-Signed-off-by: yangfasheng yangfasheng@rt-thread.com
2018-08-10 08:45:59 +02:00
Akos Kiss 17eb78aa63 Don't use a shell variable to store error output of doxygen (#2455)
Storing the error output of doxygen into a shell variable first and
echoing it later is error prone. In case of a long error output,
the whole shell will crash before being able to print the doxygen
diagnostics at all. This patch rewrites the check script to tee the
diagnostics (pipe them to console and store them to a file at the
same time) and check the output file size at the end.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-09 10:26:09 +02:00
Akos Kiss 3fd7e98d53 Make cppcheck print diagnostics only (#2456)
The progress messages of cppcheck produce a lengthy and verbose
log, making errors and warnings hard to find. This patch adds
`--quiet` to the invocation of `cppcheck`

Additionally, the patch relayouts the script to use a consistent
two-spaces indentation everywhere.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-09 10:12:18 +02:00
Akos Kiss f6b99b60d2 Reduce the scope of variable str_buf in jerry-main (#2457)
Also reduce the number of magic constants used in the code.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-09 10:11:25 +02:00
Akos Kiss 29f6ffc35b Make logging an optional feature and disable it by default (#2449)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-08 23:35:03 +09:00
Akos Kiss 58c568a68f Revisit unused global functions in jerry-core (#2450)
There are some leftover global functions in the code that are not
referenced at all anymore. These functions are removed by this
patch.

There are also some global functions that are only used in their
own modules. These functions are made static by this patch.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-08 23:34:13 +09:00
Peter Marki 47087dec56 Improve the output format of the testrunner (#2438)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2018-08-08 23:33:02 +09:00
Zoltan Herczeg 1ac2903d3c Fix a few parser style issues. (#2442)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-08-06 18:08:53 +02:00
Akos Kiss 2534d32339 Use #include<> for system headers and #include"" for own headers (#2445)
They are no big differences between the two forms as "" falls back
to <>. There are some inconsistencies in the code, though, which
are fixed by this patch.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-06 18:00:49 +02:00
Akos Kiss c93bea32c4 Simplify redundant condition in jerry-snapshot.c (#2444)
Redundant condition: is_c_format. '!A || (A && B)' is equivalent to
'!A || B'.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-08-05 15:41:58 +02:00
Daniella Barsony 64051b5bd8 Add total frame counter to backtrace in debugger (#2428)
This was needed for the VScode extension so we know in total howmany frames we have in the backtrace.

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2018-08-03 11:30:13 +02:00
Daniel Balla 87897849f6 Fix for null pointer dereference in jmem_heap_free_block (#2440)
Fixes #2435.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-08-01 23:09:30 +09:00
Robert Fancsik 1f20bb3fe5 Remove unnecessary cbc_code_flag (#2443)
The removed flag can be substituted with the combination of two existing ones.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-07-31 20:15:27 +02:00
Daniel Balla ba76b506f5 Fix broken pipe error in Jerry Debugger (#2427)
This patch fixes an error caused by trying to send data to a closed socket.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-07-31 17:36:37 +09:00
Robert Fancsik a6ace5efdf Improve lexer_expect_object_literal_id option handling (#2436)
This patch allows to add further options flags to `lexer_expect_object_literal_id` to handle unique behaviors more easily
also substitutes `PARSER_IS_CLASS` flag hence it is removed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-07-30 15:12:35 +02:00
Tamas Zakor 8482fef41a Splitting the debugger and console part of the python debugger (#2406)
Move DebuggerPrompt to jerry_client.py
Implement JerryDebugger functions in the jerry_client_ws.py file
Server response is displayed by jerry_client.py

JerryScript-DCO-1.0-Signed-off-by: Tamas Zakor ztamas@inf.u-szeged.hu
2018-07-23 13:10:39 +02:00
Robert Fancsik 77d9314b1d Simplify source evaluation options. (#2431)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-07-20 08:50:39 +02:00
Zoltan Herczeg 76ff084dc7 Move low-level debugger connection handling into jerry-ext. (#2426)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-07-19 10:14:43 +09:00
Zoltan Herczeg 88589902e2 Remove jerry_get_arg_value function. (#2425)
Remove automatic conversion of errors. Errors are
primary values, just like numbers or strings.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-07-19 10:13:40 +09:00
Tóth Béla 66dddadfd2 Change ../../libapps paths in TizenRT configuration Makefile (#2429)
This change helps the symlink method to work also with TizenRT/jerryscript configuration, while maintaining the old cp method usability.

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2018-07-18 15:52:50 +02:00
Zoltan Herczeg 9513f3792d Reduce with stack consumption by 1. (#2430)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-07-18 15:52:00 +02:00
László Langó 5f4a220a65 Added literal list loading feature to the snapshot tool. (#2422)
It is needed to load literals and register them as magic strings
to be able to generate static snapshots. Also modified the list
format saving feature to save all of the literals not only the
identifiers.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-07-16 15:13:18 +09:00
Zoltan Herczeg f86d7459d1 Fixes for ES2015 classes. (#2424)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-07-13 14:59:53 +02:00
Robert Fancsik 0ca04376a5 Fix typos in the API documentation. (#2423)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-07-13 09:36:21 +02:00
Zoltan Herczeg 857ba99694 Rework JerryScript transport layer. (#2421)
Introducing jerryscript-debugger-transport.h interface, which allows
chaining multiple protocols (e.g. tcp and websocket).

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-07-13 01:21:08 +09:00
Robert Fancsik 43aae199ce Implement ES2015 class feature (part I.) (#2404)
This patch is the first milestone of the implementation of this new language element.

Currently supported:
 - Class statement
 - Class expression
 - Static methods

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-07-13 01:20:08 +09:00
Daniella Barsony 62cdb3965f Add start to backtrace for debugger (#2407)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2018-07-12 12:44:54 +02:00
Zoltan Herczeg 04dcefe087 Rework function call. (#2414)
Furthermore add a construct flag, which disallows calling certain
functions without new. Constructing bound arrow functions correctly
throws error now.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-07-11 09:35:44 +09:00
Anthony Calandra 50daa39ee8 Optimize JSON Quote operation. (#2420)
JerryScript-DCO-1.0-Signed-off-by: Anthony Calandra anthony@anthony-calandra.com
2018-07-10 15:00:19 +02:00
Istvan Miklos 0c6b5eae65 Fix incorrect output from JSON.stringify (#2416)
This patch fixes the #2383 issue

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-07-03 19:21:45 +09:00
Anthony Calandra a456c90c1d Add %TypedArray%.prototype.fill(value, [ begin [, end ] ]) support. (#2415)
JerryScript-DCO-1.0-Signed-off-by: Anthony Calandra anthony@anthony-calandra.com
2018-07-03 19:21:14 +09:00
Anthony Calandra d5cd32b0c0 Support for %TypedArray%.prototype.set(typedArray [, offset]). (#2405)
This patch allows developers to set a typedarray given a source typedarray. This patch
attempts to follow section 22.2.3.22.2 in the ECMAScript spec as closely as possible.

JerryScript-DCO-1.0-Signed-off-by: AnthonyCalandra anthony@anthony-calandra.com
2018-07-03 15:19:53 +09:00
Anthony Calandra a74bf7dc91 Add %TypedArray%.prototype.subarray([ begin [, end ] ]) support. (#2410)
JerryScript-DCO-1.0-Signed-off-by: Anthony Calandra anthony@anthony-calandra.com
2018-06-28 09:41:07 +02:00
Istvan Miklos b9f2b1cf25 Replace jerry_value_set_abort_flag with jerry_create_abort_from_value (#2411)
Replaced the function, added some tests for it. Also changed the functions order to
alphabetical.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-06-28 08:09:03 +02:00
Zoltan Herczeg 34c081095a Fix escape sequence parsing in lexer_compare_identifier_to_current. (#2409)
Furthermore do not allow escape sequences in object initializer
get/set functions.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-23 10:02:14 +09:00
Istvan Miklos dfc0757242 Fix jerry_create_error_from_value (#2403)
Fixed the release issue, added some test cases for the function

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-06-22 12:19:13 +09:00
Imre Kiss e3265883fd Add restart command to the debugger (#2401)
With this feature the use can restart the actual debug session
(similar to the multiple source context reset) within a client.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2018-06-22 12:18:18 +09:00
Zoltan Herczeg 35ac0e0445 Fix parse_print_final_cbc dump when arguments is used (#2400)
Currently the byte code start is incorrectly set when
a non-strict arguments object is present, and a random
memory area is dumped as byte code.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-21 08:38:17 +09:00
Zoltan Herczeg 03274c112a Remove ECMA_LEXICAL_ENVIRONMENT_OBJECT_BOUND. (#2408)
Only the global object bound to the root node of the lexical environment
tree does not have a provideThis flag, and ecma_op_implicit_this_value()
falls back to the global object. Hence we get the same effect regardless
of provideThis.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-20 15:27:45 +02:00
Zoltan Herczeg acdbbf2261 Add literal property to the byte code list. (#2397)
Initializing a property with a constant is frequent in object initializers.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-20 09:06:59 +02:00
László Langó 7f56756e11 Improve sonarqube analysis to cover more code path. (#2381)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-20 10:34:49 +09:00
Zoltan Herczeg 86ecc81130 Fix literal free when show opcodes is enabled. (#2398)
A literal might be not freed if it is stored in a register,
and PARSER_DUMP_BYTE_CODE is enabled, but opcodes are not shown.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-18 09:31:13 +02:00
Zoltan Herczeg 1044523af7 Add operational mode for jerry_gc API call. (#2385)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-15 16:31:48 +09:00
Mátyás Mustoha bc827cb497 Reduce code duplication between String.charAt and charCodeAt (#2331)
JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2018-06-14 17:48:25 +09:00
Paul Sokolovsky 49c79e4774 targets: zephyr: Remove old option from prj.conf (#2396)
CONFIG_CONSOLE_HANDLER_SHELL is an old option which was removed quite
some time ago from Zephyr. (And newer versions will warn/error on
usage on such options.)

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2018-06-13 21:47:56 +09:00
Zoltan Herczeg 9625fb842e Improve instanceof operator. (#2395)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-13 19:33:27 +09:00
Akos Kiss 5398e07f99 Rework 128 bit arithmetics of ecma_utf8_string_to_number (#2392)
* Rewritten 128-bit integer "type" to use two 64-bit ints (they are
  enough), and made it a proper struct instead of an array.
* Rewritten all single-bit shift loops to multi-bit shifts with the
  help of CLZ, and used `__builtin_clzll` where available.
* Simplified (and documented) 128-bit DIV10 operation.
* Renamed 128-bit integer handling macros to use simpler names.
  (And removed unused macros that were laying around.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-12 16:04:47 +02:00
Istvan Miklos 62dee2dd71 Fix jerry_get_value_from_error (#2394)
Fix the function to take into account the second argument even if it is called with not
an error value.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-06-12 12:54:17 +02:00
Péter Gál efa8850783 Use binary mode when opening via fopen in the tools (#2371)
In the snapshot tool the files were opened
in text mode. However the snapshot files
are binary files thus it is advised to use the
binary mode when opening the files.

Specifying the binary mode is a must on Windows
platform otherwise the read/write operations
are inserting extra '\r' characters.

To make the tools consitent across OSes all
fopen are now opening files in binary mode.

Also update jerry-libc to accept the 'b'
modifier and add a test case where the JS
file uses CR-LF line endings.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-06-12 04:38:35 +09:00
Péter Gál 9ae60a4910 Improve license checker line ending validation (#2391)
The license checker previously assumed that the
lines of the license will always end with \n
characters. However when checking a file
it could happen that other line endings are
returned (should only happen for test files) thus
the checker can incorrectly report invalid license
as the line endings are incorrect.

Additional note #1: in Python when reading a file
in text mode it can happen that the line endings are
converted to the host system's line ending.
However on Travis the conversion did not happen when
using the open built-in method. By switching to the
io.open call the conversion is enforced and
all line endings are converted to '\n' regardless of
the host system's line ending.

Additional note #2: it is possible that there
are input test files which are not utf-8 conformant
(eg.: to test the parser). These files can't be read
as utf-8 strings and an exception would occur.
By ignoring these errors the tool can check
the file's license. In the license text there is no
invalid utf-8 character so the check will work
correctly.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-06-11 19:37:28 +09:00
László Langó f32c183137 Fixed assertion in 're_insert_into_group'. (#2388)
Assertion 'qmin <= qmax' failed in 're_insert_into_group', but
it should throw a SyntaxError. Fixes #2384.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-11 16:25:53 +09:00
Zoltan Herczeg bd0ea4f474 Fix wrong code order in opfunc_in (#2390)
Also no conversion if the left value is a string.

Fixes #2386.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-06-11 10:20:57 +09:00
Péter Gál d637e31933 On simple strings the utf8 substring copy api call created an assert (#2389)
When the `jerry_substring_to_utf8_char_buffer` was called
with direct strings the assert incorrectly assumed that the
string is a ref counted string and tried to access the
refcount value resulting in a failed assert.

Added direct string check for the underlying implementation
and created a test case for such simple string.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-06-11 10:19:39 +09:00
Istvan Miklos 2d0e37ff74 Replace the jerry_value_set_error_flag function with jerry_create_error_from_value (#2367)
JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-06-11 10:16:58 +09:00
László Langó be59d0a224 Remove the indentation of preprocessor directives. (#2379)
Indenting preprocessor directives reduces the code readability, because it make preprocessor directives harder to spot.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-08 15:35:23 +09:00
Robert Sipka 64c5be812c [targets/tizenrt-artik053] Fix typo in Make.defs (#2387)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2018-06-07 18:21:28 +09:00
László Langó b4b0b7d572 Merged conditions of if statements where possible. (#2380)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-06 15:08:17 +09:00
Akos Kiss b61d0ed856 Rework command line handling of build tool (#2373)
In `tools/build.py`:
- For the sake of readability, group CLI arguments as general build
  options, options to control the building of components, and
  component-specific options.
- To prevent duplications, remove the defaults from those CLI
  arguments that correspond to CMake options and have defaults in
  any of the CMakeLists. Should any of the defaults change, they
  will have to be changed at a single place only. (Those options
  that are not set on the command line of `tools/build.py` are not
  passed as options to `cmake` either.)
- Convert `--unittests` and `--doctests` to ON/OFF options like the
  rest of the component switches.
- Touch on some of the help messages of the CLI arguments.

Other changes:
- The change in `--unittests` and `--doctests` is a slightly CLI-
  breaking change of `tools/build.py`. Thus, follow up on this in
  `tools/run-tests.py`.
- Move `ENABLE_ALL_IN_ONE` into `jerry-core` as it is not a general
  option but specific to that component.
- Remove the forcing of `ENABLE_ALL_IN_ONE` for some compilers/
  platforms as it is still an option, not a hard requirement.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-06 15:07:06 +09:00
willeio 8b8bced67f Buildable as shared libraries (#2351)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: wille-io mike@wille.io
2018-06-05 08:39:30 +09:00
Akos Kiss e1af56586c Declare parser_error_to_string conditionally (#2376)
Its implementation is only available if `JERRY_ENABLE_ERROR_MESSAGES`
is defined.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-04 10:55:51 +09:00
Akos Kiss 71471a0416 Add better support for proper installation after build (#2370)
- Add `--install` option to `tools/build.py`.
- Make use of `--install` in `tools/run-tests.py` by testing the
  installed the executables instead of those in the build tree.

Related changes:
- Collect unit test binaries in the `tests` subdir of the build
  tree instead of `bin`.
- The `ls`-based collection of the unit test binaries had some
  shortcomings hitherto unrevealed (it didn't filter for files so
  it could potentially "collect" dictionaries, too), which has now
  been replaced with a more stable `find`-based solution.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-04 10:55:29 +09:00
Akos Kiss 2cabb6f8ea Remove the leftover declaration of ecma_op_create_global_environment (#2375)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-04 10:50:02 +09:00
Akos Kiss 9da010ae6e Remove legacy public headers (#2372)
Recent changes to master have already introduced API-breaking
changes. So, if someone is still including the legacy headers,
following up on the header file name changes will be the least of
their problems.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-04 10:49:38 +09:00
Akos Kiss 1b2c565850 Direct alloc/dealloc implementations for ecma_number_t (#2377)
As a result of earlier developments, there remained no other
instatiations of the `ALLOC`, `DEALLOC`, and `DECLARE_ROUTINES_FOR`
templates. So, it's simpler to write the alloc/dealloc routines
directly for `ecma_number_t` as well.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-03 15:29:28 +02:00
Paul Sokolovsky eec2623cd9 targets: zephyr: Separate CMake definitions from options. (#2378)
Add a space between definition and options substitution groups, otherwise
they make expand to something like -DFOO-DBAR.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2018-06-03 14:38:37 +02:00
Akos Kiss 3e934723a3 Make sure that API function jerry_debugger_send_output is always implemented (#2374)
Also add some missing comments to `#else` directives.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-06-03 14:28:18 +02:00
László Langó 117ea1f899 Removed unused macro definitions. (#2369)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-06-01 10:00:10 +02:00
Akos Kiss 2291467c99 Remove duplications from test runner (#2364)
- Code contains syntactic duplications (e.g., build options copy-
  pasted repeatedly).
- Build options for test suites contain semantic duplications
  (ES5.1 profile builds happen multiple times, once by not
  specifying a profile and once by specifying es5.1 profile
  explicitly).
- External build options are not taken into account when detecting
  duplicated builds.

This patch provides improvement for these issues.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-30 19:57:38 +09:00
Zoltan Herczeg 7be9f91d22 Reverse the generation of line info. (#2363)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-05-30 19:57:12 +09:00
Akos Kiss d5593c12b4 Maintenance and merging of Valgrind and Valgrind-Freya code paths (#2362)
None of the code paths have been tested for long and especially the
Freya code paths have been long abandoned. This patch:
- Merges Valgrind-Freya into Valgrind code path (there should be no
  need to choose between them, Valgrind should work just fine).
- Removes leftover code (`VALGRIND_FREYA_CHECK_MEMPOOL_REQUEST` and
  `valgrind_freya_mempool_request`).
- Adds `JMEM_` prefix to Valgrind-related macros (to correctly
  leave the `VALGRIND_` prefix to Valgrind).
- Moves the definition of the Valgrind-related macros to a common
  header to avoid duplication.

Note: Adding a CI job to perform Valgrind Memchecks is left for
follow-up as it turns out to be excessively slow (>50 mins for a
`--jerry-tests --jerry-test-suite` run, and even a simple
`--jerry-tests` may get terminated prematurely because of timeout
issues).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-29 16:33:14 +09:00
Akos Kiss 3560c60c73 Make test runners support execution runtimes (#2360)
If the result of a build is not directly executable on the host
system or needs an execution runtime for any other reason (e.g.,
cross-compiled ARM binaries on Intel, emscripten-generated JS
files, binaries built with Valgrind support) then the current test
runners cannot work with them. This patch makes test runners
execute binaries via a runtime given in the `$RUNTIME` environment
variable (if it is specified).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-29 15:22:57 +09:00
Akos Kiss a509570c1d Simplify the AppVeyor configuration file (#2361)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-28 18:59:46 +09:00
Robert Fancsik e6664f6364 Fix heap buffer overflow in re_parse_char_class (#2352)
This patch fixes #2230 and fixes #2237.
Test cases are added for both issues and also adds new cases which caused the same error.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-05-28 10:13:17 +02:00
Istvan Miklos ac9fce1d8d Merge jerry_get_value_without_error and jerry_value_clear_error_flag functions (#2350)
JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-05-25 11:40:35 +02:00
Akos Kiss 4779451284 Cleanup code around JERRY_UNREACHABLEs (#2342)
`JERRY_UNREACHABLE`s often signal code structure that could be
improved: they can usually either be rewritten to `JERRY_ASSERT`s
or eliminated by restructuring loops, `if`s or `#if`s. Roughly,
the only valid occurences are in default cases of `switch`es. And
even they can often be merged into non-default cases.

Moreover, it is dangerous to write meaningful code after
`JERRY_UNREACHABLE` because it pretends as if there was a way to
recover from an impossible situation.

This patch rewrites/eliminates `JERRY_UNREACHABLE`s where possible
and removes misleading code from after them.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-25 07:27:30 +02:00
Zoltan Herczeg acb3e71436 Add JERRY_VLA calls to the snapshot tool. (#2357)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-05-25 10:34:55 +09:00
Akos Kiss 06910b456e Fix issues revealed by cppcheck 1.83 (#2355)
A more recent cppcheck has revealed some extra issues not detected
by the old one running on CI.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-24 15:48:34 +09:00
Robert Fancsik 9eb9fbf5f1 Fix heap buffer overflow in lit_utf_incr (#2345)
This patch fixes #2344.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-05-22 10:32:40 +02:00
Akos Kiss 43075a2ce6 Consolidate compiler-specific parts of CMakeLists (#2349)
The cmakelists contained various compiler-specific parts scattered
across the file. This patch moves them to as few conditional blocks
as possible.

Additional changes:
- `-Werror` does not depend on whether jerry-libc is enabled.
- Some stylistic fixes.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-22 17:15:40 +09:00
Akos Kiss cc473425d3 Fix cmakelists of doctests to run generation only once (#2347)
Custom commands with outputs used in multiple targets are prone to
being executed multiple times in parallel builds (and the repeated
overwrites of the outputs may lead to various hard-to-debug
errors). The fix is to add a custom target that depends on the
custom command and make the existing targets using the outputs
depend on the new custom target.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-22 09:14:18 +02:00
Akos Kiss 299643400d Don't let doctests pollute the source tree (#2346)
The patch changes the cmakelists of the doctests to extract the
test sources from the markdown docs into the binary tree.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-20 14:37:38 +09:00
Akos Kiss 5ddbfa5953 Add AppVeyor badge to readme (#2341)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-20 14:32:52 +09:00
Akos Kiss 7424d299d8 Define JERRY_UNREACHABLE for MSVC (#2340)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-20 14:32:07 +09:00
Akos Kiss 22339e0b54 Retire the Mbed OS 3 target (#2343)
Mbed OS 3 is discontinued, long live Mbed OS 5.

resolves #2338

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-20 14:31:25 +09:00
Akos Kiss 145ab1ed79 Simplify run-time feature checks in unit tests (#2339)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-19 07:07:21 +09:00
Yonggang Luo 872825fb57 Add Windows support. (#2306)
JerryScript-DCO-1.0-Signed-off-by: PKarics karicska@gmail.com
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2018-05-18 19:42:14 +09:00
Akos Kiss 13bd30ff54 Remove legacy jerry_get_memory_limits API function and unused configuration macros (#2329)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-18 10:43:52 +02:00
Zoltan Herczeg 5560c76b41 Convert certain push number opcodes to literals (#2328)
Binary operations are much faster with literal arguments.
The byte immediates are still kept for other cases, e.g. array declarations.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-05-18 17:22:53 +09:00
László Langó 64b16bf190 Update Doxygen config file and fix Doxygen warnings (#2324)
A lot of warnings remained hibben because 'EXTRACT_ALL' was previously set to YES.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-05-18 15:43:17 +09:00
Akos Kiss fb6259b2ec Fix parameter constness differences in function declarations and definitions (#2337)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-18 09:39:42 +09:00
Mátyás Mustoha 0415d74a74 Reduce code duplication in the TypedArray implementations (#2319)
This patch was done in cooperation with Tamás Kéri.

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2018-05-18 09:38:41 +09:00
Peter Gal 27dcfa51e1 Build fix after landing #2249
The old `jerry_value_has_error_flag` function was used
when the #2249 PR was merged.

Replaced with the correct `jerry_value_is_error` call.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-05-17 13:56:37 +02:00
Istvan Miklos ea1133b210 Add tests for TypedArrays by using indexing api. (#2249)
JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-05-17 10:29:52 +02:00
Akos Kiss 36f6435eb8 Revert the Mbed Travis CI job to sudo-based VM to avoid sporadic OOMs
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-16 16:34:19 +02:00
Akos Kiss 53bd845d9f Move (almost all) Travis CI jobs to container-based infrastructure (#2333)
Container-based VMs promise significantly faster boot times.

More or less related changes:
- Added a JOBNAME to all jobs.
- Added `install-noapt` target to several Makefile.travis files to
  avoid `sudo apt-get install ...` steps. Those installations are
  now handled by the apt addon of Travis. The `install` targets are
  kept anyway to keep the makefiles self-contained.
- Removed a legacy workaround from the Coverity Scan job as it
  isn't necessary anymore to fiddle with the cerificates of
  scan.coverity.com.
- Fixed the Mbed and the Zephyr jobs.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-16 19:15:15 +09:00
Akos Kiss 19451fa2d1 Use ecma_number_t instead of double where possible (#2330)
Some code paths explicitly used double instead of ecma_number_t
even though the values assigned from or compared to were of type
ecma_value_t.

Related to #2251

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-16 09:17:34 +09:00
Péter Gál 38f0dbf065 Remove 'useless' variable from function.bind (#2327)
The `args_length` variable in the `ecma_builtin_function_prototype_object_bind`
method is not needed, the `arguments_number` variable can be
directly used.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-05-15 09:03:40 +09:00
Peter Gal 86111acbc4 Remove usage of comma operator in array prototype
There was a typo in the `ecma_builtin_array_prototype_helper_set_length`
method as the comma operator was used to close the statement, incorrectly

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-05-15 00:52:30 +02:00
Akos Kiss 65ae949dc3 Add jerryscript-compiler.h public header to cover compiler incompatibilities (#2313)
In general, public headers should not have compiler-specific
constructs but both the core and the port headers have attributes,
which are non-standard. It's better to factor out such constructs
to a common place (a new header) and hide them behind macros, which
can then be defined on a per-compiler basis.

This patch moves the existing definitions of function attributes and
likely/unlikely builtins to the new header. At the same time, it
unifies the names of these attribute defines and where they are
used. Moreover, it touches on jerry-main and removes the uses of
`__attribute__((unused))` entirely and replaces them with the
elsewhere used `(void) ...` pattern.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-14 09:41:26 +09:00
László Langó 0e131da4f7 Add SonarQube badge to 'README.md' and update '.travis.yml' to fix a warning. (#2325)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-05-12 14:20:51 +09:00
László Langó c829b307e5 Followup fix for SonarQube setup (#2322)
Fix the condition whether Travis should run the SonarQube analysis

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-05-11 09:11:20 +02:00
Akos Kiss 134845e099 Simplify code paths within PARSER_DUMP_BYTE_CODE (#2316)
Also fix an uncovered issue in the reporting of switching to strict
mode.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-10 19:37:19 +09:00
László Langó b0120423da Setup SonarQube analysis in Travis CI (#2321)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-05-10 10:42:40 +02:00
Mátyás Mustoha 1261cf3a54 Fix some incorrect documentation (#2320)
JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2018-05-09 17:37:27 +02:00
Akos Kiss d6cf634239 Refactor/fix/document the default port implementation (#2317)
- Various constructs could be expressed with simpler and/or more
  readable code.
- The jerry_port_log implementation for the debugger case was prone
  to buffer overflow error.
- Some documentation was still missing (even from
  jerryscript-port.h).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-09 11:15:45 +02:00
László Langó a1f71f8937 Update the 'README.md' of the JerryScript profiles. (#2309)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-05-08 17:14:41 +09:00
Akos Kiss fbb9bf31b2 Fix documentation of port API (#2312)
The patch fixes both the doc comments in the port header and the
corresponding markdown documentation.

The patch also removes an internal configuration macro guard
exposed by the public port header.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-08 15:07:05 +09:00
Akos Kiss 7981820dfb Use logging macros in jerry-core/debugger (#2315)
...instead of directly calling the logging port API function.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-08 11:41:51 +09:00
Istvan Miklos 7e4e551dd5 Fix sign-conversion warning on gcc when compiling to raspberry pi 2 (#2308)
JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-05-08 11:41:05 +09:00
Akos Kiss 5f60208d1e Tabulation/indentation fixes (#2314)
- Status messages in CMakeLists.txt files got misaligned, fixing.
- An extra space sneaked in before an `#ifdef`, fixing.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2018-05-07 15:51:55 +02:00
Gabriel "_|Nix|_" Schulhof 6dc2764a94 modules: add ability to clear cache (#2300)
This adds the ability to remove a single module from the cache, or to
clear the entire module cache.

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2018-05-04 10:12:17 +09:00
Istvan Miklos 369447aa09 Rename the jerry_value_has_abort_flag function. (#2291)
Rename the function to represent it's real functionality.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-05-03 16:50:16 +02:00
Peter Marki 51e193de57 Remove the html based debugger tools and add a readme with information about available debug tools (#2299)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2018-05-03 09:36:00 +02:00
Robert Sipka b750a9e0b2 Update links and add a new one to the latest memory usage and binary footprint results for Artik053 (#2304)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2018-05-03 08:32:16 +02:00
Istvan Miklos ba2e49caaa Rename the jerry_value_has_error_flag function. (#2290)
Rename the function to represent it's real functionality.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-05-03 08:24:05 +02:00
Mátyás Mustoha d672d1e71c Reduce code duplication between Object.isFrozen and isSealed (#2296)
JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2018-04-26 13:51:27 +02:00
Peter Marki 06ada9e6b4 Remove unused tool scripts (#2298)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2018-04-24 17:24:00 +09:00
Mátyás Mustoha 63ce292173 Reduce code duplication between RegExp.construct and [[Call]] (#2287)
JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2018-04-20 15:27:33 +02:00
Mátyás Mustoha a76926623a Reduce code duplication between String.match and search (#2277)
Moved the common preparation code for 'search' and 'match'
to a separate function.

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2018-04-20 14:04:59 +02:00
Achie72 3df6ef30c0 Implement toString and join for TypedArrays. (#2255)
JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2018-04-19 10:14:34 +02:00
Mátyás Mustoha c288cdad48 Reduce code duplication between Array.reduce and reduceRight (#2280)
Their code differs only in handling the array index.

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2018-04-19 09:13:20 +09:00
Zoltan Herczeg 5e097dc354 Add line info support. (#2286)
Add line info data to byte, which allows getting a backtrace info directly
from the engine. Snapshots are not supported.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-04-19 09:12:54 +09:00
Zoltan Herczeg 095b730f9d Improve stopping at errors. (#2278)
In some cases the debugger catches (reports) the same
exception multiple times. This is confusing since these
not new errors. This patch fixes this behaviour.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-04-18 19:31:17 +09:00
Zoltan Herczeg 96b528a486 Rework jerry_parse function. (#2282)
Remove jerry_parse_named_resource, merge its arguments to jerry_parse
and change is_strict argument to an option list for possible future extensions.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-04-17 09:51:52 +02:00
Mátyás Mustoha 3f3d4a64f1 Reduce code duplication between Array.forEach, some, and every (#2275)
Their implementation only differs in the stop condition and the
final return value.

JerryScript-DCO-1.0-Signed-off-by: Mátyás Mustoha mmatyas@inf.u-szeged.hu
2018-04-13 13:32:46 +02:00
László Langó 2bfd3b75b7 Put 'Zephyr/Arduino 101 Build Test' to allowed failures temporarily. (#2279)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-04-13 14:28:46 +09:00
Peter Marki d86a507fdf Eliminate dead code in ecma_builtin_object_object_get_prototype_of (#2276)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2018-04-11 21:03:35 +09:00
Zoltan Herczeg e91471727f Support abort in the debugger. (#2273)
Aborts are not caught by catch/finally blocks,
so it is possible to stop a script using the debugger.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-04-11 13:59:13 +02:00
Zoltan Herczeg 5c0c21b26a Rework snapshot execution api. (#2270)
The _at functions replaces the original functions.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-04-11 10:39:58 +09:00
Tibor Dusnoki 46309b1502 Fixes return value of 'Date.now' (#2274)
'Date.now()' should return an integer value. Fixes #2272
JerryScript-DCO-1.0-Signed-off-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
2018-04-09 13:27:16 +02:00
tdusnoki cb40106693 Use jerry_is_feature_enabled function instead of macros where possible (#2271)
JerryScript-DCO-1.0-Signed-off-by: Tibor Dusnoki tdusnoki@inf.u-szeged.hu
2018-04-09 08:26:36 +02:00
Peter Marki 8392eef8ad Implement the ES2015 version of Object.getPrototypeOf and add a test file for it (#2256)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2018-04-05 14:28:28 +02:00
Zoltan Herczeg 7b226f53e0 Rework snapshot generation API. (#2259)
Also remove eval context support. It provides no practical advantage.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-04-05 13:43:55 +02:00
Martijn Thé 35926f3f85 Add finalize_cb to jerry_context_data_manager_t (#2269)
This patch adds a new finalize_cb callback to jerry_context_data_manager_t.
The callback is run as the very last thing in jerry_cleanup, after the VM has been torn down entirely.
There was already the deinit_cb, which is run while the VM is still in the process of being torn down.
The reason the deinit_cb is not always sufficient is that there may still be objects alive (because they still being referenced) that have native pointers associated with the context manager that is being deinit'ed.
As a result, the free_cb's for those objects can get called *after* the associated context manager's deinit_cb is run. This makes cleanup of manager state that is depended on by the live objects impossible to do in the deinit_cb. That type of cleanup can only be done when all values have been torn down completely.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2018-04-05 12:57:51 +02:00
Zoltan Herczeg 27939f0884 Simplify debugger-ws.h (#2266)
Remove several macros and types from it. This change simplifies
the external debugger interface.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-04-05 11:22:44 +02:00
ZsoltRaduska 78bd11e732 Add json parse and stringify function to jerryscript c api (#2243)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Raduska rzsolt@inf.u-szeged.hu
2018-04-05 09:58:07 +02:00
ZsoltRaduska 0476523f1a Improve jerry_is_feature_enabled with object availability information (#2250)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Raduska rzsolt@inf.u-szeged.hu
2018-04-05 09:54:07 +02:00
Daniel Balla f06d637238 Add ecma_free_all_enqueued_jobs function (#2265)
This function releases any remaining promise job that wasn't completed.
Also added this function to `jerry_cleanup ()`, therefore it will be automatically run.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-04-05 09:49:25 +02:00
Geoff Gustafson 634d9d38da Fix bug in stringToCesu8 conversion for 0x7ff (#2267)
JerryScript-DCO-1.0-Signed-off-by: Geoff Gustafson geoff@linux.intel.com
2018-04-04 10:17:16 +02:00
Istvan Miklos ff37959195 Remove TARGET_HOST macros (#2264)
Remove TARGET_HOST defines from the jerry-libc module and replace with compiler provided macros.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-04-03 14:58:47 +02:00
Jimmy Huang a0e315719b Remove websocket message macros in debugger (#2262)
JERRY_DEBUGGER_INIT_SEND_MESSAGE
JERRY_DEBUGGER_SET_SEND_MESSAGE_SIZE
JERRY_DEBUGGER_SET_SEND_MESSAGE_SIZE_FROM_TYPE

JerryScript-DCO-1.0-Signed-off-by: Jimmy Huang jimmy.huang@intel.com
2018-04-03 09:06:20 +02:00
Péter Gál 708f66ad91 Fix accessing the contents of a direct string (#2261)
In the `ecma_string_get_chars` method
the contents of a direct string is accessed incorrectly.
It tries to extract the magic string id from the
string pointer but the direct string does not need
this step.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-03-29 20:20:59 +02:00
Daniel Vince ba22072db8 Fix typo and redundant text in the documentation. (#2260)
JerryScript-DCO-1.0-Signed-off-by: Daniel Vince vinced@inf.u-szeged.hu
2018-03-29 10:52:20 +09:00
Daniel Balla 8af89d951e Add the ability to throw an error to python debugger (#2188)
This patch makes it possible to throw an error from the python debugger client using the `throw` command.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-03-28 16:46:24 +02:00
Tamas Zakor 79289714dc Remove unused functions which caused build error on clang (#2257)
JerryScript-DCO-1.0-Signed-off-by: Tamas Zakor ztamas@inf.u-szeged.hu
2018-03-27 16:10:49 +02:00
Peter Marki e54dde55fe Add tests for the es5.1 profile to tools/run-tests.py (#2217)
JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2018-03-24 10:48:08 +09:00
imiklos 15f6ca9f70 Move the sleep function to jerry-port (#2245)
Now the jerry-debugger uses the jerry-port's sleep, therefore if there are systems that don't support
usleep or nanosleep can now define their own function.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-03-22 10:36:40 +09:00
haesik d701a7bfb1 Remove ineffective codes (#2248)
Results of assert statements are always true,
I think we don't need these assert statements anymore

JerryScript-DCO-1.0-Signed-off-by: Haesik Jun haesik.jun@samsung.com
2018-03-21 18:37:46 +09:00
imiklos 6e9a94bf1a Remove new line from output log in python client. (#2244)
There was an unnecessary new line character in the python debugger client.

JerryScript-DCO-1.0-Signed-off-by: Istvan Miklos imiklos2@inf.u-szeged.hu
2018-03-21 18:37:13 +09:00
Péter Gál 66d0f53bbb Remove a few ECMA_TRY_CATCH macro usages (#2246)
By removing the ECMA_TRY_CATCH macros at these
places  ~200 bytes of .text is saved on rpi2.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-03-21 18:36:38 +09:00
Gabriel "_|Nix|_" Schulhof 3664d9ddd1 Add an API to traverse objects by their associated native data (#2236)
JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2018-03-21 08:48:27 +01:00
Zoltan Herczeg bb84466fcf Support static snapshots. (#2239)
Unlike normal snapshots, no part of a static snapshot is loaded into
the RAM when executed from ROM. Static snapshots rely heavily on
external magic strings.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-03-20 07:46:52 +09:00
Achie72 dde09cc4b6 Fix JSON.stringify, to allow TypedArray printing (#2242)
JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2018-03-19 14:12:33 +01:00
Yuyupo 0b76ea6c82 Create snapshot test (#2241)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2018-03-14 14:01:03 +01:00
Imre Kiss a79c217aa0 Add finish debugger command. (#2240)
With this command the engine continue running just after the function
in the current stack frame returns.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2018-03-12 14:42:48 +01:00
Daniel Balla 685af74a10 Multiple nexts with one command (#2207)
Make a next command more gdb like.
If an argument is given `next 10`, it does 10 nexts.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-03-08 10:46:03 +01:00
Roland Takacs 29b337d159 Eliminate early memory deallocations in case of NuttX and TizenRT (#2235)
The error value is released in the print_unhandled_exception function, however
that value is used and released later. This patch fixes this bug.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-03-06 08:22:22 +01:00
Yuyupo 63e3eaf087 Remove ecma_get_length_string (#2234)
Fixes #2231

JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2018-03-05 15:17:29 +01:00
Zoltan Herczeg 7b0e1672ae Improve property search. (#2232)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-03-05 14:54:33 +01:00
Zoltan Herczeg b9f96a64d9 Support large string constants in 32 bit cpointer mode. (#2233)
After this patch, all sunspider tests run when cpointer 32 is enabled.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-03-05 11:41:52 +01:00
László Langó 94760b1213 Improve builtin instantiation (#2226)
* Resolve linker errors with -O0 in some compilers
 * Reduce the stack usage

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-03-02 14:37:03 +01:00
Péter Gál 55058cf151 Add quiet mode for test runner(s) (#2228)
In one of the previous PR we have encountered a problem,
where the Travis cuts off the test execution
as the generated log file is too big.

By adding a quiet mode for the test runners, we will
only report the failing tests.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-03-02 10:18:17 +09:00
Péter Gál 575ec7e10a Check _XOPEN_SOURCE macro before defining (#2220)
In jrt.h the _XOPEN_SOURCE macro is defined.
However if the compiler already specifies this as
a default define, it can lead to compiler warnings
or errors.

By adding a macro check the warnings/errors can be
avoided.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-03-02 10:17:25 +09:00
Zoltan Herczeg d60d4dbba9 Improve magic string handling. (#2221)
Remove unnecessary ref / deref calls when magic strings are used.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-03-01 13:31:15 +01:00
Martijn Thé 26ee8f7137 Bugfix: check context manager deinit callback for NULL before calling it (#2222)
The deinit_cb should be allowed to be NULL.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2018-03-01 09:31:39 +01:00
siposb94 ccc283289c Added several negative tests (#2215)
JerryScript-DCO-1.0-Signed-off-by: Balint Sipos siposb@inf.u-szeged.hu
2018-02-28 05:47:56 +01:00
László Langó e10f6d6adf Modified ecma string to utf8 string conversion to reduce binary size. (#2214)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-02-27 14:52:30 +01:00
László Langó 72b51accc8 Reduce the memory footprint of 'ecma_instantiate_builtin' (#2218)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-02-27 10:16:23 +01:00
László Langó fbc53f78b7 Eliminate the pylint warnings and update the pylint configuration (#2210)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-02-27 10:14:48 +01:00
László Langó 88f7baa192 Fix build failure of NuttX tools (#2225)
The CI is broken after 'https://bitbucket.org/nuttx/tools/commits/164450f982b404fdc2b3233db51dc3eaa1f08b7f',
because it cannot find 'aclocal-1.15'.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-02-27 10:12:05 +01:00
Geoff Gustafson d990832569 fix typos in debugger code (#2219)
JerryScript-DCO-1.0-Signed-off-by: Geoff Gustafson geoff@linux.intel.com
2018-02-23 08:22:16 +09:00
Zoltan Herczeg 51e3c4455a Implement direct strings. (#2196)
Direct strings are a new type of direct ecma-values (no memory allocation
is needed for encoding them) in JerryScript. Currently magic strings,
external magic strings and uint values are encoded as direct strings.

The constant pool of JerryScript byte-code is changed to hold ecma-values
rather than cpointers to support direct strings.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-23 08:21:46 +09:00
László Langó fbf5c32747 Removed 'is_static' parameter from 'BUILTIN' macro, because was never used. (#2216)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-02-22 09:14:56 +09:00
Zoltan Herczeg d841270747 Exclude hashmaps from GC marks. (#2212)
Fixes #2146.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-22 09:13:49 +09:00
Martijn Thé b8656877e2 Fix misc. compiler warnings (#2202)
JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2018-02-20 16:13:04 +01:00
László Langó 6fce323fa5 Fix assertion in 're_insert_simple_iterator' (#2209)
It is a followup fix after #2169. It also fixes a memory leak.
This fixes #2198 and fixes #2204

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-02-19 16:57:45 +09:00
László Langó c4b61db57a Fix '--cmake-param' option of the build script. (#2208)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2018-02-19 11:29:58 +09:00
Martijn Thé 3c57698ed8 Fix buffer overrun while parsing malformed JSON hex escape sequence (#2201)
Fixes https://github.com/jerryscript-project/jerryscript/issues/2200

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2018-02-16 09:02:03 +01:00
Péter Gál d7991ae54c Add C API to query the type of a JS value (#2195)
New API function:
 * jerry_value_get_type

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-02-13 13:48:07 +01:00
Péter Gál 4652c3caaf Add OpenWrt build guide (#2199)
There was an OpenWrt toolchain file however it's a bit outdated and
we did not have any guide on how to build for this target at all.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-02-12 17:21:57 +09:00
Daniel Balla e8608707b6 Make source scrolling command in python debugger (#2187)
Source is now scrollable after writing `scroll`.
Keys are `q` to quit, `w` to scroll up `s` to scroll down.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-02-07 09:38:54 +01:00
Zoltan Herczeg 67cee1f478 Remove arguments of ecma_new_values_collection. (#2197)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-07 13:05:04 +09:00
Péter Gál 6f339eb05c Introduce C API to query the type of an Error object (#2177)
New api function:
* jerry_get_error_type

Additionally update a few places where this new function
can be used.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-02-06 09:41:54 +01:00
Péter Gál 8041953a7a Add TypedArray C API (#2165)
New API functions added:
 - jerry_value_is_typedarray
 - jerry_create_typedarray
 - jerry_create_typedarray_for_arraybuffer_sz
 - jerry_create_typedarray_for_arraybuffer
 - jerry_get_typedarray_type
 - jerry_get_typedarray_length
 - jerry_get_typedarray_buffer

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-02-06 08:01:32 +01:00
mofosyne 0cc98340c3 Update documentation for jerry string to buffer function with suggestions to use substring. (#2174) (#2174)
In some use cases, you want to reliably copy jerry strings to buffer, even if it doesn't fit target buffer, but is acceptable to lose some bytes. In those cases, the documentation will now suggest using the substring function as an alternative instead.

JerryScript-DCO-1.0-Signed-off-by: Brian Khuu mofosyne@gmail.com
2018-02-02 12:09:57 +09:00
Daniel Balla c429530d02 Fix multiple JSON.parse issues (#2191)
Fixes #2180, #2192

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2018-02-01 22:34:21 +01:00
Zoltan Herczeg 36051ec92b Limit maximum number of arguments for apply(). (#2183)
The length*sizeof(ecma_value_t) may overflow on 32 bit systems which
cause a memory corruption when the values are filled.

Fixes #2182.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-01 15:09:53 +01:00
Zoltan Herczeg 06ebfc52ed Simplify ECMA_OP_TO_NUMBER_TRY_CATCH macro. (#2185)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-01 19:31:17 +09:00
Zoltan Herczeg c935e4b7e2 Return early if number conversion is failed in arraybuffer slice. (#2184)
Fixes #2181.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-02-01 19:30:03 +09:00
Szilard Ledan 607e605844 Fix regex brackets matching bug (#2179)
Fixes #2178.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan szledan@inf.u-szeged.hu
2018-01-31 09:27:32 +01:00
Zoltan Herczeg 918eb22a01 Add support for aborts. (#2176)
Aborts are similar to exceptions except they are not caught by catch
and finally blocks. Callbacks should honor aborts as well and return
them without processing them. Aborts are never thrown by JavaScript
code.

In the future certain events such as out-of-memory condition may
also throw aborts.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-01-30 09:13:44 +09:00
Zoltan Herczeg b548eae4ad Improve get characters of a string function.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-01-29 10:35:56 +09:00
Martijn Thé 0d04c805ac Zero out unused bytes in snapshots (#1980)
Compiled code blocks are sized in multiples of JMEM_ALIGNMENT,
but it's possible that some bytes at the end remain unused and get filled
with junk. This causes snapshot output to become nondeterministic.
To fix this, zero out the compiled code buffer before using it.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2018-01-26 08:26:09 +01:00
Peter Gal 4b699e997a Add ArrayBuffer with user specified buffer
New API functions:
 - jerry_create_arraybuffer_external
 - jerry_get_arraybuffer_pointer

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-01-25 10:14:53 +09:00
Roland Takacs 7acd688513 Print the return value of the engine in case of TizenRT.
Since TizenRT doesn't have any commands to get the return value of a process,
added a debug print line that shows the return value.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-01-25 09:28:18 +09:00
Szilard Ledan a4afde2663 Change '{' regex parsing to work similarly to other engines (#2134) (#2169)
Changed regex parsing to be able to handle opening braces
as other engines do, and also added a compile flag which
can disable this behaviour.

JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan szledan@inf.u-szeged.hu
2018-01-24 12:18:44 +01:00
Zoltan Herczeg 1c64c1aeb7 Fix inserting pending breakpoints. (#2163)
Before this patch the JS execution is started right after the parsing
is completed. The problem is that some parts of the JS code is executed
before the debugger had any chance to insert pending breakpoints due
to network latency. This patch adds a delay after parsing when at least
one pendding breakpoint is available.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-01-23 10:47:47 +01:00
Peter Gal 40d05cdca2 Add version fields for debugger configuration
By adding version information to the debugger protocol
it is possible to report if the debugger client and server
have different expectations on debugger workings (opcodes, types, etc.).

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-01-23 10:17:33 +09:00
Robert Fancsik 52a14fa08f Fix the endianness of EPS8266 system
Also fix the order of js sources by evaluate the main.js for the last time.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-01-22 18:13:07 +09:00
Roland Takacs 680bafdc8c Modify the build method of TizenRT target
Introduced a cmake/toolchain_mcu_artik053.cmake file that defines
all the target specific compiler options.

Modified the Makefile.tizenrt to do not copy the created static
libraries to the TizenRT folder. Instead, the application builder
Makefile (tizenrt-artik053/apps/jerryscript/Makefile) copies the
required static libraries to TizenRT.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-01-16 10:57:37 +09:00
Péter Gál ded0d5a846 Introduce the Array Buffer C API (#2161)
Add C API to work with Array Buffers.
The following methods are added:
- jerry_value_is_arraybuffer
- jerry_create_arraybuffer
- jerry_arraybuffer_write
- jerry_arraybuffer_read
- jerry_get_arraybuffer_byte_length

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2018-01-11 20:36:08 +01:00
Zoltan Herczeg b9560b7c70 Rework ecma collection. (#2153)
Greatly simplify the iterator part and make it compatible with 32 bit cpointers.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2018-01-10 15:55:56 +01:00
Roland Takacs f833da2c13 Modify the build method of NuttX target. (#2154)
Modified the Makefile of the NuttX target to build only the application
file (targets/nuttx-stm32f4/jerry-main.c) and not the whole project.
It helps to build JerryScript separately and use the static libs when
building NuttX.
Also modified the README.md to describe the new build process.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.uszeged@partner.samsung.com
2018-01-09 09:34:01 +01:00
Zidong Jiang 4e7a9d2d53 [jerryx/arg]add jerryx_arg_utf8_string (#2133)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2018-01-08 10:17:40 +01:00
Paul Sokolovsky 290bc22f0c targets: zephyr: Update for Zephyr 1.10 which uses CMake-based build. (#2155)
In 1.10, Zephyr RTOS switched to CMake as means to generate application
makefiles. Consequently, drop Makefile, and introduce CMakeLists.txt,
and update master Makefile.zephyr accordingly.

With these changes, take a chance to make following "cosmetic" changes:

1. Make "qemu_x86" board target the default instead of "arduino_101".
Arduino 101 is just one of the boards of many supported by Zephyr
(and thus JerryScript port), while qemu_x86 is something everyone has.

2. Zephyr make target to run QEMU switched from "qemu" to "run".

3. Don't rely that there's zephyr.strip, it's presence is now
board-dependent. The most we can rely on is zephyr.elf.

targets: zephyr: Remove deprecated prj.mdef file.

MDEF files have been deprecated and ignored for few Zephyr releases.

targets: zephyr: Increase main (i.e. interpreter) thread stack size.

qemu_x86 target now has stack guard enabled by default and it trips with
the default stack size. Set it to 2K for now.

targets: zephyr: Makefile.travis: Update for Zephyr 1.10.

Zephyr 1.10 requires SDK 0.9.2 and CMake 3.8.2.

Also, don't hardcode CC path, it depends on a board and choosed
automatically by Zephyr build system.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2018-01-08 09:49:07 +01:00
tkeri e0e6aa0319 Add new snapshot execution test cases (#2160)
Add new function to avoid code duplication.

Add two new test cases to jerry_exec_snapshot function:
* test enable copy byte-code with global mode
* test enable copy byte-code with eval mode

JerryScript-DCO-1.0-Signed-off-by: Tamas Keri tkeri@inf.u-szeged.hu
2018-01-08 09:44:50 +01:00
Robert Sipka d6df000fe5 Update tests results badge links in the README
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2018-01-06 12:33:06 +09:00
Robert Fancsik 543f75a6c3 Fix random number generation on ESP8266
This patch uses the onboard RTC for generating random seed. It also improves the print handler to support float values.
The rom segment is slightly increased to fit to the latest master.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2018-01-04 19:22:08 +09:00
Zidong Jiang c3c0bb8ddc [Bugfix]free error in typearray set value routine (#2147)
Issue: #2143

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-12-20 12:52:29 +01:00
tkeri be9e88784a Fix unit-test inconsistency for promises (#2152)
Use a helper function to check the availability of promise.

JerryScript-DCO-1.0-Signed-off-by: Tamas Keri tkeri@inf.u-szeged.hu
2017-12-20 12:50:12 +01:00
Zoltan Herczeg a2d3ea61eb Optimize string concatenation. (#2141)
This patch adds two new string concatenation functions:
ecma_append_chars_to_string and ecma_append_magic_string_to_string

The former appends a cesu8 byte array and the latter appends a magic string
to the end of an ecma-string. These two free (dereference) their ecma-string
argument, and this change is also applied to the original ecma_concat_ecma_strings
function which simplifies string handling in most cases.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-12-19 13:45:48 +01:00
Robert Sipka bd574956e3 Fix conversion warnings (#2126)
NuttX and artik053 build - compiling with strict Werror=conversion - fail when jerry-debugger option is enabled.
This patch based on #2007, because most of them are fixed earlier within that PR, but it was closed before the land.

Credit: Piotr Marcinkiewicz p.marcinkiew@samsung.com

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-12-19 10:37:24 +01:00
Greg Miell 10f777689f Add extern "C" to module.h (#2150)
JerryScript-DCO-1.0-Signed-off-by: Greg Miell greg@gothack.ninja
2017-12-18 21:08:45 +01:00
László Langó 623fabd6e6 Put 'Mbed/K64F Build Test' to allowed failures temporarily. (#2151)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-12-18 12:14:02 +01:00
Daniel Balla 96df210cc5 Add object type checking to instantiation
It wasn't properly checked if the given object was an arrow function, therefore it always got wrongly casted into `ecma_arrow_function_t`.
Fixes issue #2110
*plus fixing a typo in the comments

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-12-13 18:14:34 +09:00
Zidong Jiang 11e0c13094 Add api: jerry_get_value_without_error_flag (#2096)
It is used to get the reference value from a error value

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-12-13 12:46:20 +08:00
Robert Fancsik 458dc58b59 Improve multiplication in vm
This patch improves the ecma_integers_values multiplication by checking if the multiplier or multiplicand is power of 2.
If it is it uses right shift instead of multiplication.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-12-11 17:47:39 +09:00
Robert Fancsik 90f2473f08 Remove trivial ecma_number arithmetic functions (#2123)
The affected function calls have been replaced with the appropriate arithmetic operands.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-12-07 13:41:02 +01:00
Péter Gál 8b109510fd Move _XOPEN_SOURCE macro to a more generic place (#2136)
Building with all-in-one and enabled debugger caused
errors as the sleep functions were not defined.

By moving the _XOPEN_SOURCE macro to a generic place
we make sure that the required sleep functions are
present in every case.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-12-07 11:54:37 +01:00
Akos Kiss 75ac090dd9 Refactor CLI argument handling and test runner logic of run-tests.py (#2091)
On argument handling:
- Merged all signoff check options into one, option value chooses
  between strict/tolerant check variants.
- Added sensible metavars to options with arguments (consistent
  with metavars of build.py).
- Reordered options to match the order the checks are executed in.
- Added `--all` alias to `--precommit` check option.
- Beautified code (always placed `help` on separate line, removed
  unnecessary arguments of `add_argument` that just repeated their
  defaults).

On test runner logic:
There was too many code duplication on how checks were executed, it
got refactored. No change in semantics.

The only change was in Travis CI-related invocations,
`--check-signed-off-travis` had to be rewritten to
`--check-signed-off=travis`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-12-07 11:54:14 +01:00
Robert Fancsik e83de3accd Remove ecma_simple_value_t and refactor ecma_make_simple_value (#2135)
This patch removes all ecma_make_simple_value calls to make the code more easy to understand.
Also removes the type ecma_simple_value_t which improves the performance in related code paths by calculating the value of new ecma_value_t is no longer needed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-12-06 18:06:07 +01:00
László Langó 1007b63024 Fix clearing of error reference (#2131)
'ecma_clear_error_reference' must increase the reference of the returned
ecma value referenced by the error if there are more than one reference.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-12-06 14:47:40 +01:00
Peter Gal a8a6122a93 Force python2 when running test262
The test262 python script is not python 3 compatible
so we force it to be executed with python2.

Additionally print out the reason if the execution
failed.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-12-06 13:16:25 +09:00
Zoltan Herczeg e964393abe Add fast path to ecma_op_object_get with magic string. (#2078)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-12-05 17:17:56 +01:00
Peter Gal a8dffe023e Fix the mbed Travis build
On Travis the Python (by default) is a bit old
and causes problems when the yotta is being used.

Switching to Python 2.7.13 solves half of the problem.

The other problem is the pyOpenSSL 17.5 and Linux
library incompatibilities. Thus we force the pyOpenSSL
to a pre-17.5 version.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-12-05 20:16:25 +09:00
Marko Fabo 0fe8f6abac Improve bitwise operations in VM. (#2117)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-11-30 10:13:04 +01:00
Sanggyu Lee bf78065bc6 Update build guide for TizenRT 1.1
Previous guide is out of date.
Updated guide works with TizenRT 1.1.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-11-30 09:04:47 +09:00
Daniel Balla a1df9c1420 Fix undefined behaviour of global object freezing
Freezing the global object and later trying to add properties to it caused an assertion error (issue #2105).
This patch fixes the issue.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-28 11:30:10 +09:00
Imre Kiss 1ed886b872 Fix function parsing for debugger. (#2119)
Since the JerryScript can able to parse functions directly the
PARSER_LEXICAL_ENV_NEEDED and the PARSER_NO_REG_STORE flags
should be in the context's status flags for executing eval operations
by the debugger.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2017-11-22 15:29:07 +01:00
Zidong Jiang 29056f9ab9 Fix error-free issue in promise
Fix issue: #2107

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-11-21 19:49:44 +09:00
Zidong Jiang 9a9dcf3332 Fix bug in promise resolve handler
Should get the error_value if `then` prop is an error.

Fix issue: #2111

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-11-21 14:25:51 +09:00
tkeri e15020be96 Fix api inconsistency for promises (#2113)
The change makes the jerry_value_is_promise api method
available in all cases, just like other promise api methods

JerryScript-DCO-1.0-Signed-off-by: Tamas Keri tkeri@inf.u-szeged.hu
2017-11-20 15:41:11 +01:00
Robert Fancsik fe6c7b9b61 Fixed TypedArray error handling
This patch fixes #2106. The problem was that the function always tried to transform the array-like object to TypedArray object even if there was an error during TypedArray creation.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-20 16:55:22 +09:00
rerobika 1dedc1b630 Fixed toFixed method string conversion (#2112)
This patch fixes #2108. The problem was if the convertible number had less significant fractions digits than the requested, the result was filled with memory junk instead of zeros.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-17 20:00:45 +01:00
rerobika 6c06a309c1 Fixed dynamic-stack-buffer-overflow in jerry_value_is_syntax_error (#2095)
Fixes issue #2094, which introduced an error caused by jerry_value_is_syntax_error.
The problem was that the function used strcmp instead of strncmp while checking if err_str_buf contains syntax error and it caused buffer overflow.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-17 11:39:11 +01:00
Marko Fabo b4a1825a83 Avoid code duplication in vm.
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-11-17 18:25:00 +09:00
Akos Kiss b43057c90b Add grouping macro guards for disabling engine features (#2084)
Until now, the engine's feature set was configurable either via
`CONFIG_*` macro guards defined individually on compiler command
line or via profiles (which are text files listing macro guards,
picked up by the cmake build system and turning them into compiler
command line options). And the features under profile control are
all enabled by default (i.e., all macros are `CONFIG_DISABLE_*`).

This causes a maintenance issue when new features are added to the
engine, because the disabling macros have to be added to all
profiles that don't include the new features. This can even cause
"compatibility break" for applications that embed JerryScript but
don't use the cmake or the python build system, because then
profiles are unavailable and all feature disabling guards have to
be explicitly passed to the compiler. (I.e., if such an application
wants to use the ES5.1 feature set, it must define all the ES2015
disable macros; if the engine is developed further and a new ES2015
feature gets implemented, then the new feature will sneak into the
application's binary unless its own build system is changed to add
the new feature guard.) Even the in-repo example Curie BSP target
seems to have suffered from this maintenance problem.

This patch introduces two new grouping macro guards that enable the
disabling of all ES5.1 builtins and all ES2015 features. As the
grouping logic is in config.h, the maintenance of non-cmake-based
build systems becomes easier (and there is no change for the python
and cmake-based build systems).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 16:31:30 +01:00
Akos Kiss 36479ddc1a Remove the 'external' toolchain file (#2089)
The 'external' toolchain file does nothing but transitively sets
some cmake system variables from values received on the command
line, and forcibly sets the C compiler. However, the same cmake
system variables can be directly set via the command line, together
with the C compiler, and specifying a toolchain is not a must.
Thus, this patch drops the superfluous 'external' toolchain file
and updates cmake-based targets to invoke cmake in a simpler form.

Related changes in this commit:
- While updating the cmake invocations, all the command line
  arguments have been reviewed and simplified (removed those, which
  did not change the defaults).
- Removed unnecessary forced C compiler settings from some
  toolchain files (and/or changed them to setting the "compiler
  works" flag to true, thus keeping cmake's compiler identification
  logic but disabling some of its overzealous compiler sanity
  checks).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 16:19:00 +01:00
Akos Kiss da24727824 Add Travis CI jobs for build testing several targets (#2102)
Hitherto, code under the `targets` directory was not tested and so
its maintenance was sometimes speculative. This commit adds build
testing for several targets to prevent them from bit rotting.
Targets covered by this commit are: ESP8266, Mbed, Mbed OS 5,
NuttX, RIOT, Tizen RT, and Zephyr.

Some issues were revealed and fixed:
- ESP8266: added missing include for `uint32_t` typedef.
- Tizen RT: replaced missing `str_to_uint` with `strtol`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 13:29:23 +01:00
Akos Kiss a0db3ee5b3 Ensure that the test version of the command line tool is stable for benchmarking (#2076)
Some benchmark suites contain test cases that have nonreproducible
behaviour. This is mostly caused by relying on "now" when dealing
with dates or timestamps, instead of using a fixed moment. (A
notorious example is the crypto-aes.js test case of the sunspider
bechmark suite, where the heap memory consumption can vary between
34K-41K heap because of using `(new Date()).getTime()`.)

This commit renames the jerry-minimal command line tool to
jerry-test (to better reflect its purpose) and adds extra code,
which intercepts some calls to libc (`gettimeofday`, `rand`) and
pins their results to some fixed values. This makes the tool
useless in a general case but ensures stable results when
benchmarking -- for which it is mostly used.

As a side effect, the commit also changes jerry-libc by making all
libc functions weak symbols to allow their override from
application code.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-16 12:36:58 +01:00
Péter Gál 7692aa9d66 Improve the heap limit measure tool (#2092)
Changes:
 * Added support for Python3
 * Suppressed the build output text
 * Code cleanup
 * Fixed pylint warnings

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-11-15 17:02:32 +01:00
Gabor Loki 1059fb1b30 Fix a small typo in the port API documentation (#2099)
JerryScript-DCO-1.0-Signed-off-by: Gabor Loki loki@inf.u-szeged.hu
2017-11-15 17:01:32 +01:00
Daniel Balla 7ad3edde08 Fix typo in byte-code.h (#2100)
Fixing a typo in byte-code.h, plus removing unnecessary guarding around it.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-15 17:01:01 +01:00
Akos Kiss 6b1ed6e021 Refactor/simplify .travis.yml (#2090)
Over time, `.travis.yml` grew somewhat organically and became quite
complex. With some rewrites, it can set up the Travis CI stages
better, and become simpler, more logical, and more maintainable.

The refactoring keeps all existing functionality.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-13 15:36:40 +01:00
Akos Kiss 52ecafc888 run-tests.py test options maintenance (#2087)
Pythonification of the `Options` class and unification of the
instance names.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-13 13:52:56 +01:00
rerobika 5d2000c954 Fix for issue #1993 (#1994)
This patch fixes this bug which caused corrupted stack by preventing unnecessary double to ascii conversion even if
the convertible number of digits is higher than allowed.
In addition, improved ecma_double_to_binary_floating_point function by removing a needless buffer.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-10 15:13:08 +01:00
Akos Kiss 1d2a686532 Whitespace gardening in jerry-libc (#2082)
Also includes the addition and styling of some doc comments (but
those are whitespace too).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-11-10 13:12:44 +01:00
Zidong Jiang 2865826fc4 [jerryx-module]Fix a bug in module name comparison (#2079)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-11-10 13:11:26 +01:00
Marko Fabo 9c013310ab Include missing header file in mbed/mbedos5. (#2083)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-11-10 12:58:53 +01:00
Daniel Balla 7e51423ca7 Fix Date.parse() in ecma-builtin-date.c (#2081)
Fixes issue #2073, which introduced an error caused by Date.parse()
The problem was that the function didn't properly check if there was a ':' after the hours.
If any UTF8 character was inserted there which got decoded into multiple characters, it caused the pointer to point at a wrong character.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-09 21:12:29 +01:00
Robert Fancsik 519ba8eb6c Fixed template literal parsing
Fixed an unhandled corner case while parsing slashes and template literals.
This patch fixes #2039 and adds a test case for it.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-09 14:12:34 +09:00
Robert Fancsik c3a9821171 Revive target: ESP8266
This patch updates ESP8266 build system and code base as well.
 - Removed unnecessary files.
 - Decreased code size.
 - Refactored jerry_{port, extapi, run}.c to make it more easy to handle.
 - Readme.md is updated as well which contains detailed step by step description about how to set up environment and use JerryScript.

Finally, it solves the related issue #1375.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-11-08 19:13:34 +09:00
Marko Fabo bdcd2d8179 Free JERRY_CONTEXT (error_value) (#2071)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-11-06 15:48:05 +01:00
Daniel Balla 3de6c7ec7a Fix jerry-libc's srand function (#2068)
The previous implementation of srand was wrong in jerry-libc.
It set all 4 values to the seed, not modifying anything in them, causing random values to be repeated pretty often.
This approach fixes the mentioned issue.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-06 11:31:22 +01:00
Péter Gál 8ae659227e Move snapshot generation function to the snapshot tool (#2057)
Now there is a snapshot tool which can merge snapshots
but was unable to generate snapshots by itself.

This change moves the snapshot generation utilities
to the snapshot tool.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-11-05 18:37:27 +01:00
Zsolt Borbély ee24965bcf Add missing headers for srand() to jerry-minimal and riot-stm32f4
A buildoption test is also added to test jerry-cmdline-minimal.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-11-04 12:17:59 +09:00
Daniel Balla 4690d128b3 Add info to documentation about random numbers, initialize srand (#2056)
Issue #2053 has highlighted the fact that random numbers are always generated with the same seed.
An example of generating different random numbers, other than the original seed, has been added to the documentation.
Furthermore srand initialization has been added to jerry-main, and targets.
Update test-common.h with srand call.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-11-03 15:31:57 +01:00
Marko Fabo 678fcb20ed Free the error_value of the global context before raise an error. (#2067)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-10-31 15:47:20 +01:00
Zidong Jiang 5bd72047cc jerryx: add jerryx_arg_array (#2052)
Related issue: #2046

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-10-30 20:39:14 +01:00
Akos Kiss 60bf613c07 Add regression test from issue #2008 (#2066)
The issue was reported against v1.0 and isn't reproducible anymore.
Still, adding the then-faulty input to the regression test suite to
prevent it occuring again.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-10-30 14:53:22 +01:00
Péter Gál 0ee7509030 Install pylint for user on Travis (#2064)
On Travis the pylint package can't be installed
due to insufficient permissions.

To fix this we'll try to install the package for the user
and not for the system.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-10-30 14:46:29 +01:00
Marko Fabo d9cc3fd4b7 Improve runtime by concatenation of opcodes. (#2059)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-10-29 08:19:18 +01:00
rerobika 6dae81565c Improve ecma_utf8_string_to_number function (#2006)
This patch extends the infinity and zero parsing of the convertible number by checking the normalized number exponent part.
This improvement prevents the engine's hanging while converting extreme big numbers.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-10-27 12:32:29 +02:00
Zidong Jiang 0bc4bb056d Fix promise thenable bug
Related Issue: #2060

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-10-27 18:37:58 +09:00
Marko Fabo d7c710d3d4 Delete unnecessary ?: statement.
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-10-25 09:45:49 +09:00
Zoltan Herczeg 53cd324179 Rework error to use a global slot to store the error value.
This change frees up the error bit in ecma_value_t, which allows
to define 4 more value types (e.g. symbols). To keep API
compatibility we introduce a box for values with error flag.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-10-24 17:33:04 +09:00
Akos Kiss 742654a3f1 Fix #endif comment at end of header files (#2049)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-10-21 14:47:37 +02:00
Daniel Balla 2f6c105522 Fix pending breakpoints in python debugger client (#2028)
There was an issue where pending breakpoints were incorrectly tried to be assigned to files, since they missed the sourcename check. It's also worth mentioning that pending breakpoints were not "moved" correctly to active status, just copied there instead, making them appear in the pending list still.
This patch fixes both of these issues.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-10-19 11:49:33 +02:00
Peter Gal 4913a42086 Fix API docs
The #2043 introduced a bit of error in the API
docs as there was missing backticks.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-10-19 16:26:59 +09:00
Péter Gál 6d988afbf4 Introduce a way to directly save snapshot functions and load them back (#2043)
Added two new api functions:
* jerry_parse_and_save_function_snapshot
* jerry_load_function_snapshot_at

The jerry_parse_and_save_function_snapshot function allows
creating snapshots from snapshot arguments and body source.

The jerry_load_function_snapshot_at function enables loading
back functions from a given snapshot as a JS function object.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-10-18 15:03:54 +02:00
Akos Kiss d0143adc82 Replace JERRY_JS_PARSER feature guard with JERRY_DISABLE_JS_PARSER (#2036)
* Replace JERRY_JS_PARSER feature guard with JERRY_DISABLE_JS_PARSER

All feature guards of jerry-core are deciding about the inclusion
or exclusion of a feature based on the state (defined or undefined)
of a macro -- except for the JS parser guard, which requires
`JERRY_JS_PARSER` to be defined with a value of either 0 or 1. This
has some issues:
- The engine cannot be built with a "clean" compiler invocation,
  i.e., without any `-D` command line macro definitions. This is
  painful for targets that must use a different build system from
  the project's own python/cmake-based one.
- Some build systems in targets and even some code in jerry-code
  are already confused about the different semantics of
  `JERRY_JS_PARSER`, and simply define it without a value and make
  decisions based on the macro being simply defined or not.

This patch renames the guard to `JERRY_DISABLE_JS_PARSER` and makes
use of it in jerry-core based on its state, not based on its value.
As obvious from the guard name, the default for the JS parser is
that it is included in the build.

The patch also touches those targets in the repository that
explicitly defined the original macro (correctly or incorrectly).

* Make cppcheck verbose

Cppcheck can be quite slow sometimes, especially on Travis CI,
which has a "10 mins without output means failure" rule. As the
code base of the project grows, we start to undeterministically
fall over that limit. Thus, this PR makes cppcheck verbose to
ensure that it keeps Travis CI continuously fed with output.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-10-17 17:11:54 +02:00
Zoltan Herczeg fe26674752 Support multiple primary functions in a single snapshot. (#1797)
This patch adds an extension to snapshots which allows storing
multiple position independent primary functions in a single
snapshot data. A new application called jerry-snapshot is
added to the project to manage snapshots. Currently the only
option is merging snapshots.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-10-12 14:43:32 +02:00
Zoltan Herczeg 9f0cf9ef1c Implement this binding for arrow functions.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-10-06 09:07:13 +09:00
Zsolt Borbély 1cc7cb58ce Enable promise builtin for nuttx-stm32f4 target (#2033)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-10-04 15:46:18 +02:00
Gabriel "_|Nix|_" Schulhof eb92b22b19 Fix possible uninitialized value (#2035)
JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-10-03 10:24:39 +02:00
László Langó 1027eb0c32 Updated the Doxyfile input directories. (#2024)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-10-02 11:57:28 +02:00
Zoltan Herczeg 29ea702fa4 Free the GC mark bit to increase the number of object types. (#2032)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-09-29 16:15:13 +02:00
Gabriel "_|Nix|_" Schulhof 6d53931055 module extension: add support for canonical name resolution (#2013)
Before attempting to load a module, each provided resolver must be given an
opportunity to examine the name of the requested module without actually
loading it so as to canonicalize it, in case a module can be referred to by
multiple names.

Then, modules are loaded and cached by their canonical name.

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-09-29 12:02:34 +02:00
Daniel Balla e527e41bac Fix typo in the debugger documentation (#2027)
The old function name was used in one occurrence.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-09-28 06:20:18 +02:00
Zoltan Herczeg 8a5bfd2279 Implement template literals. (#2025)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-09-27 11:24:51 +02:00
Gabriel "_|Nix|_" Schulhof fe864bcf53 Add job that tests with FEATURE_INIT_FINI turned ON (#2026)
Since modules behave differently depending on whether this feature is on or off
we should have a job that runs with the feature turned on.

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-09-27 10:51:42 +02:00
Zoltan Herczeg c6a33dd407 Implement arrow function parsing. (#2022)
Note: the special this behaviour of arrow functions is not implemented.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-09-26 10:40:45 +02:00
Gabriel "_|Nix|_" Schulhof 81952f3cd0 module: Re-implement using library constructors/destructors (#2018)
By using constructors/destructors we unify the case of static linking with
that of dynamic linking, and we reuse the build flag FEATURE_INIT_FINI. Using
constructors/destructors also allows us to cover the case where library
constructor/destructor functionality is unavailable, because we can expose the
module registration/unregistration functions as global symbols, to be called
explicitly from within the application.

Fixes https://github.com/jerryscript-project/jerryscript/issues/1952

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-09-22 12:35:38 +02:00
Zoltan Herczeg 8d916a44f1 Parse functions directly (#2015)
This patch adds direct function source code parsing, which
is useful to avoid source code duplications. The patch
also improves the Function constructor.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-09-21 11:03:23 +02:00
Zoltan Herczeg 7713d30702 Rework jerry_debugger_wait_for_client_source to use a callback.
The jerry_debugger_wait_and_run_client_source function is renamed to
jerry_debugger_wait_for_client_source and a callback is added which
is called when the source is received. Inside the callback the
application is free to do anything with the received source code.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-09-21 17:49:49 +09:00
Marko Fabo 9c3f814357 Fix #1931
The mentioned patch uses `this_obj` argument to get `setInterval` and
`setTimeout` properties from the global object, but `this_obj` is
undefined
in these scopes.

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-09-21 17:44:57 +09:00
Zsolt Borbély 9900fd930f Allow mem-stats when system allocator is enabled
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-09-21 09:58:43 +09:00
Robert Fancsik 15ee7bc036 Fixes pattern parsing in ecma_builtin_global_object_unescape ()
Issue #1990 revealed an unhandled corner case while parsing pattern. This patch fixes it and also adds a test case.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-09-21 09:58:15 +09:00
Robert Fancsik 30867e27e0 Fixes uint16_t overflow in ecma_new_ecma_string_from_utf8_converted_to_cesu8 ()
This unreported test issue revealed an assertion in jmem_heap_finalize ().
During the conversion the lot of additional information what a cesu8 represented string needs caused overflow while setting the new ecma_string_t variable's length. This patch fixes this issue and the mentioned test case is available here:
https://gist.github.com/rerobika/3bd590fdcf664a3fcfcc98f11b14c74e

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-09-20 15:09:15 +09:00
Imre Kiss 77ccdcc585 Add context reset to the debugger.
- The context reset request message can be sent anytime from a client.
- After the message received the engine will call the cleanup and init
  when in the source waiting mode (which means the currently processed file will be executed).
- After the reinitialization is done, the engine will wait
  for a new client connection(rest of the work is the client's responsibility).

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2017-09-13 18:12:44 +09:00
Zoltan Herczeg 04bccea6a6 Last line of the source code should be printed by the python debugger client.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-09-13 09:38:35 +09:00
Daniel Balla c8b99d05e1 Send every kind of output to the debugger client
Now correctly sending jerry_port_log output to the debugger client as well.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-09-07 19:02:24 +09:00
Zidong Jiang c21c21f9f9 [ecma-collection] Check whether the header's first chunk is NULL
Fix Issue: #1997

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-09-07 17:42:51 +09:00
László Langó a54427e255 Followup changes in JerryScript debugger after #1910.
* Remove 'jerry_debugger_cleaup'. Do it automatically in 'jerry_cleanup'.
* Updated the documentations.
* Updated the NuttX and Artik053 targets.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-09-07 17:26:03 +09:00
Daniel Balla a51def40e7 Fix #1947
If a literal was assigned the unused flag it wasn't freed, however it could have been not empty, therefore should've been freed.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-09-07 09:42:08 +09:00
Daniel Balla 7ccbe97b79 Move jerry_debugger_send_output to public API
The function jerry_debugger_send_output wasn't placed correctly in the public API.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-09-07 09:36:02 +09:00
Dániel Bátyai 01dd2f0b2a Clean up radix conversion in Number toString method (#2002)
The radix conversion code path was very messy which made it hard to understand
what was happening inside of it. The code got cleaned up, and a lot of comments
were added that explain what is happening and why.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2017-09-06 10:56:29 +02:00
Zidong Jiang 74045f2964 [Promise] check the argc of builtin resolve/reject handler
Fix issue: #1996

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-09-05 18:42:46 +09:00
Zidong Jiang 78e3d88bd9 [unix-main] call jerry_run_all_enqueued_jobs before cleanup
Related Issue: #1995

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-09-05 17:43:37 +09:00
Tamas Keri 39275c5dd2 Add minimal heapsize finder tool
Added a python tool which finds the smallest possible size of
JerryHeap without failing to run the given js file.

JerryScript-DCO-1.0-Signed-off-by: Tamas Keri tkeri@inf.u-szeged.hu
2017-09-05 17:42:42 +09:00
Yanhui Shen b32e5444d8 Allow "<NUL>" character within string literals in strict mode
JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2017-09-05 09:13:01 +09:00
Zoltan Herczeg 522c7d3f87 Correctly enumerate function property members.
Functions has several built-in non-enumerable properties, and
they are correctly ignored during enumeration after this patch.

External function prototype is also lazy enumerated.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-09-05 09:11:35 +09:00
Daniel Balla 7905422b19 Merge send_string functions in python debugger client (#1989)
Merging the messages to one check, therefore multiple duplicated lines are removed.
I didn't find a good solution though in the HTML client, since it would be nested switch cases / ifs, which wouldn't look okay IMO, the other solution would only save like 2 lines of code overall.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-09-04 12:33:28 +02:00
Jan Jongboom 5cdb98c75e target: mbedos5: Use math.h from stdlib, not from jerry-libm (#1988)
The math.h header file in JerryScript is lacking a number of functions which are required to build for certain mbed OS 5 targets. NUCLEO_F207ZG target fails to build as sqrtf() is not defined in this header file. Exclude this file from the build process, so the math.h from stdlib is included instead.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2017-09-04 12:11:02 +02:00
rerobika ce187049e9 GC should ignore not fully initialized objects (#1983)
Fixes #1970 which caused segmentation fault.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-09-04 10:25:19 +02:00
Robert Fancsik 0ef2418e5e Fix ecma_op_array_object_set_length method
So far a freed variable was tested during error flag inspection.
This patch fixes it and #1972 as well.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-08-31 08:55:51 +09:00
Daniel Balla 733f0ceea0 Send output to debugger client (#1955)
Sending the output to the debugger client, at the moment only the JS side prints are sent over.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-08-30 16:01:06 +02:00
Zoltan Herczeg e897858c64 Reduce the memory consumption of function objects. (#1954)
Several properties of strict and bound functions are moved to
lazy property instantiation. The memory consumption of bound
functions are also reduced when only a this is present.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-08-30 14:17:35 +02:00
Jan Jongboom 82a94d0f88 target: mbedos5: Update to mbed OS 5.5.5 (#1982)
Switches fatal implementation to JerryScript default, updates to latest stable version of mbed OS. Tested on K64F.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2017-08-30 13:08:01 +02:00
Robert Fancsik e62b5b601b Fix for issue #1974
The buffer size was previously badly computed since scale == 0 case was not checked, therefore the buffer size was smaller than intended.
This patch fixes this issue.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-08-30 09:07:26 +09:00
Tamas Keri 5d18ac8f0c Remove unnecessary if statement
JerryScript-DCO-1.0-Signed-off-by: Tamas Keri tkeri@inf.u-szeged.hu
2017-08-28 18:02:55 +09:00
fbmrk 1a18766488 target: mbedos5: Improve setInterval and setTimeout (#1931)
In setInterval and setTimeout there must be a reference increase to the given function.
If you use `jerry_acquire` and you want to cleanup the engine,
you get an assertion, because this value is released nowhere in the code.
In my opinion it is better to set the function as a property, so it is released automatically.

In launcher.cpp there is bad error handle. If `returned_value` has error flag, `parsed_code` is not released.

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-08-25 15:01:53 +02:00
fbmrk fe32b5c5d1 target: mbedos5: change all get/set_object_native_handle to get/set_object_native_pointer (#1898)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-08-25 11:24:04 +02:00
Hosung Kim 5de69b4ede target: tizenrt-artik053: Update porting
- rename artik05x to artik053
- fix to add library for jerryscript
- add rom patch for artik053
- enable jerry cmd in tizenrt
- change to absolute file path when loading file with jerry cmd
- update README.md and config file

JerryScript-DCO-1.0-Signed-off-by: Hosung Kim hs852.kim@samsung.com
2017-08-22 17:26:54 +09:00
Imre Kiss 3b1d578050 Multiple client source sending feature. (#1957)
Whit this enhancement the debugger can able handle more than one source file across the new source wait mode.
This feature can be used by the python client with the --client-source [paths] switch.
The client will store every source path, when the debugger send a signal about the waiting status, then the client will send one file from the list.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2017-08-21 09:19:36 +02:00
Zidong Jiang 2888a6f488 [jerryx-arg]Check NaN in jerryx_arg_int
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-08-17 09:15:35 +09:00
Sanggyu Lee c1cff3f961 Fix new ArrayBuffer(length) for variaous input (#1959)
Currently new ArrayBuffer(length) does not conform to ES2017.
Major JS implementations follow ES2017 for ArrayBuffer(length).

For example, new ArrayBuffer(length) should not throw RangeError
for length = NaN, undefined, negative number, floating point, and so on.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-08-16 18:20:41 +08:00
Sanggyu Lee af16a3ae1a Implement typedarary.set(array, offset)
JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-08-11 14:38:37 +09:00
Daniel Balla a48f24f8da Reworking jerry_debugger_send_string method
From now on, jerry_debugger_send_string can send a subtype of the string, making it more simple to send over strings with special parameters, therefore seperating different types of messages are simpler.
Enumerations for various subtypes can be made, while there's only need to have 2 entries for the header type.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-08-10 08:28:58 +09:00
Robert Fancsik ad608e30dc Improve toFixed function
Fixes #1367.
From now numbers are represented as binary floating-point which guarantees the expected operation of toFixed function.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-08-10 08:27:27 +09:00
Imre Kiss 148f91c90d Fix internal jmem_heap_finalize assertion in debugger.
In case of received client source the client_source_data_p was not freed.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2017-08-08 10:24:19 +09:00
Zidong Jiang c242248b47 Add API for get the memory stats (#1923)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-08-04 09:44:37 +02:00
Daniel Balla 8b5fe254d9 Implement source rework to HTML client (#1866)
Implementing the source command rework - along with display - to the html client too.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-08-04 09:44:05 +02:00
Imre Kiss 3e3d6373b8 Add source sending feature to the debugger. (#1932)
With this feature the debugger webIDE and the python client can able to send a source code to the debugger while that is running in wait mode.
This feature can be activated with the --debugger-wait-source switch and the debugger will wait for the source messages.
If every message part are received the debugger will continue the exectuion with the initalized options.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2017-08-03 14:29:47 +02:00
rerobika a3885be6ce ecma_delete_property must recreate the hashmap even if one of the properties is still valid. (#1938)
Fixes #1934.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-08-02 08:19:48 +02:00
Martijn Thé 66b072d5ae Fix: make jerryx_module_resolve resolvers argument const (#1942)
The resolvers argument that is passed to jerryx_module_resolve() is
not mutated by the function. Therefore the argument should be const.
In the docs, a static const array is passed, but this currently does not
work w/o a cast. This patch fixes this.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2017-08-01 15:39:21 +02:00
Zsolt Borbély 2a2a15f364 Make the webpage-generator script able to transform relative links
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-07-30 18:30:06 +09:00
Zidong Jiang 5b22e5e0ff Bugfix: the value in test cases should be invariable (#1939)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-07-27 13:37:20 +02:00
Zidong Jiang a4bc229592 Bugfix: should return error immediately in ecma_op_create_typedarray
Related issue: #1936

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-07-27 17:08:24 +09:00
Marko Fabo af2868ddb7 Add delete_property_by_index to the API
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-07-24 09:13:36 +09:00
fbmrk 1526bcc8c3 target: mbedos5: fix requirements.txt (#1933)
tools/generate_pins.py does not work with 2.18 version of pycparser

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-07-21 11:54:07 +02:00
rerobika d75710cf27 replace_str_curr_p must be inspected before dereferencing (#1926)
Fixes #1917.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-07-20 10:26:51 +02:00
László Langó ce1d555288 Fix regression after #1927
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-07-20 16:58:08 +09:00
fbmrk 44833cf7be Fix code inserting in API-REFERENCE.md (#1928)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-07-19 11:25:33 +02:00
László Langó 0ef9b8e027 Fix RegExp character class compilation on unicode ranges.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-07-19 10:26:23 +09:00
Sanggyu Lee 5fd98fa2be Change tizenrt-artik05x port reference board to artik053
Artik053 board is publicly announced about one month ago.
So I updated tizenrt-artik05x reference board from sidk_s5jt200 to artik053.
Now, tizenrt-artik05x port works with latest TizenRT repo on artik053 board.

Also, I replaced str_to_uint to strtol since #1891 is landed.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-07-19 10:15:52 +09:00
Marko Fabo 270dbb00b2 error_name must be freed before return
Fixes #1918

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-07-19 07:19:02 +09:00
Gabriel "_|Nix|_" Schulhof 66b2a7670f New extension: module (#1863)
This extension provides the following facilities:
  - registering modules,
  - module resolvers, and
  - an API for retrieving a module instance given its name.

A module is defined as a global static structure containing a pointer
to a string which is the name of the module, and a pointer to a function
which will be called when an instance of the module is needed.

A module resolver is a function that accepts a string holding the name
of the module and returns a `jerry_value_t` in an out-parameter and
`true` if the module was found, or `false` if it was not. If it returns
`true` and the out-parameter has the error flag set then the API will
pass it through without caching.

This extension provides a built-in module resolver which attempts to
load modules that follow the above module definition.

The API provided by this extension invokes all module resolvers it
receives in sequence to attempt to resolve the name of a single module.
After one resolver returns `true` and a `jerry_value_t` that represents
the module the API stops iterating over the remaining resolvers and
caches the value if its error flag is not set. It then returns the
`jerry_value_t`. The API will return a `jerry_value_t` containing an
error indicating that the module was not found if it reaches the end of
the list of resolvers. The error it returns has an extra property
`"moduleName"` the value of which is a string containing the name of the
module that the API was asked to resolve.

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-07-18 15:54:24 +02:00
yichoi 5f2c72c472 Add test result information to the README.md (#1911)
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2017-07-17 13:40:56 +02:00
Osamu-Nakamura bb8ac29cce Revise the mistake in the example function described in "Step 5. Description of JerryScript value descriptors in docs/03.API-EXAMPLE.md (#1919)
JerryScript-DCO-1.0-Signed-off-by: Osamu Nakamura osamu.nakamura.xt@renesas.com
2017-07-16 10:32:01 +02:00
Akos Kiss 1f7606fc05 Improve pylint runner script (#1915)
- On OSX, `find` is more picky about its arguments than on Linux
  and requires the start directory(-ies) to be explicitly mentioned
  before the expressions (a.k.a. "primaries"). However, until now,
  the `pylint` runner script called `find` without a start dir,
  which caused an error on OSX.

- Until now, `find` looked for python scripts in all subdirectories
  of the project, causing `pylint` to check scripts under `targets/`
  and `tests/test262` (if `test262` was checked out). However, the
  files under `targets/` are less strictly controlled while
  `test262` is completely beyond the control of the project. This
  caused a lot of superfluous lint warnings.

This patch makes the `pylint` runner script call `find` in the
cross-platform way, and also limits the scope of the lint checks to
the `tools/` and `jerry-debugger/` directories.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-07-14 19:53:59 +02:00
yichoi 0844499cec Add IRC badge for convenience (#1920)
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2017-07-14 17:52:36 +02:00
Zidong Jiang 8c9b0d4086 Fix empty string issue in ext/args (#1921)
Now the js string "" can be converted to C array by jerryx_arg_string

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-07-14 17:41:02 +02:00
Akos Kiss 00f93bc287 Add support for doctests (#1909)
Markdown files in the docs/ directory can now be annotated to turn
fenced C code blocks into unit tests. The recognized syntax is:

    [doctest]: # (name="test.c", test="run")

    ```c
    // unit test code
    ```

The commit also fixes the issues revealed during the initial
annotation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-07-14 16:18:20 +02:00
Robert Fancsik 3d744c958f Shifting array element down in the tree must be finished even if an error occurs
Fixes #1671

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-07-13 17:54:14 +09:00
Daniel Balla dbfb0170c1 JerryDebugger breakpoint system rework (#1908)
Reworking the python JerryDebugger breakpoint system.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-07-13 10:26:14 +02:00
Robert Sipka 89015a6119 Improve split method to gain memory (#1893)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-07-10 10:49:16 +02:00
Martijn Thé 91912689ad Fix hash calculation for strings created using jerry_create_string_from_utf8 (#1912)
The hash was being calculated over the bytes *after* the actual string bytes.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2017-07-10 08:53:58 +02:00
Akos Kiss 18283d22c0 Make debugger port runtime configurable
Convert debug server port from a compile-time constant to a context
variable. This enables each engine instance (either running in the
same process or in different processes) to listen for connections
at different ports, i.e., multiple engines can be debugged at the
same time on the same machine.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-07-06 07:08:00 +09:00
fbmrk cfa4fdd1ef target: mbedos5: unnecessary acquire and argument check bug (#1892)
When you cleanup the engine you got an `ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p)` error.
There is an unnecessary call of jerry_acquire_value which causes the problem.

Also in the InterruptIn-js.cpp file there is a wrong check of an argument.

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-07-05 23:09:10 +02:00
fbmrk d3cf335dad target: mbedos5: fix mbedignore (#1894)
Ignoring the entire jerry-port/default library causes a link error, because of the need for the defaultx-handler.c source file.

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-07-04 11:54:36 +02:00
Sanggyu Lee 0b08322a21 Fix build warning in jerry-ext/arg on tizenrt-artik05x
tizenrt-arttik05x treats warning as error for uninitialized use.
This patch fixes the error in jerry-ext/arg by initializing to zero.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-07-04 16:20:44 +09:00
Youngil Choi a823169bde Add daily measurement information to READ.md
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2017-07-04 15:09:25 +09:00
Zoltan Herczeg e6832f5f27 Rework argument parsing.
Heavily simplify the interface of CLI.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-07-04 08:56:55 +09:00
Sanggyu Lee 6b0d9e1b6a Throw SyntaxError for identifier with supplementary character
Fix assertion failure issue #1871 on github.
Don't allow supplementary character as identifier start or part.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-07-03 08:31:20 +09:00
rerobika f359eb2d1b Stack data should be freed for while statements after the expression is parsed (#1897)
Fixes #1873.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-06-30 10:29:19 +02:00
rerobika 3c992de2b8 Fix a build error (#1895)
Fixed an error when neither of libraries are found the build fails.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-06-29 12:11:18 +02:00
rerobika c31e8b8c17 Add timeout to jerry_debugger_receive (#1885)
Fixed when debug server uses a CPU core on 100%.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2017-06-28 11:26:45 +02:00
Akos Kiss 2f140e3b7f Add strtol to jerry-libc and make use of it in jerry-main (#1891)
As a side effect, refactor the variable types in
`print_unhandled_exception` to reduce the overuse of sized integer
types (generic `unsigned int` is better than `uint32_t` if there is
no actual requirement on integer width).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-06-26 17:10:07 +02:00
Zidong Jiang b153475093 add transform functions for integer in jerryx/arg (#1883)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-06-21 19:32:13 -05:00
Zidong Jiang e4eecc2019 add transform_object_properties in jerryx/arg (#1879)
Add a function in jerryx/arg.
jerryx_arg_transform_object_properties, it will validate the properties of a JS object, and convert those properties into native type.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-06-19 19:51:08 -05:00
fbmrk 7cc9d65c09 target: mbedos5: use jerry-ext (#1889)
Update target mbedos5 to use external function handlers: `assert`, `gc` and `print` from jerry-ext.

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-06-16 20:25:00 +02:00
fbmrk 70b078faa4 Update target mbedos5 README. (#1880)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-06-16 09:57:56 +02:00
Martijn Thé b947f56fd0 Add jerryscript-ext/autorelease.h with JERRYX_AR_VALUE_T (#1874)
JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2017-06-16 00:09:19 -05:00
Zidong Jiang 940f1f89c9 Check if it is object in Promise.prototype.then
Fix issue #1881

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-06-08 17:08:20 +09:00
Péter Gál d56713b9af When compiling with gcc 7 the current fallthrough comments (#1878)
are not accepted. This is a bug in gcc 7.

For now disable the fallthrough comment detection.
Disabling the check does not introduce any risk
as previously it was not enabled by default and
vera++ already check these kind of comments.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-06-08 17:07:40 +09:00
Péter Gál add60865e0 Rename files under jerry-code/debugger to avoid build fails (#1877)
Without the file renaming there are two jerry-debugger.c files.
Thus when the jerry-core archive is created there are two objects
in it with the same name. Generally this does not create any problems.
However if the archive is extracted then the second object file
will overwrite the first one which results in undefined reference
linkage error.

The jerry- prefix was removed from the file names and
fixed the include oreders where it was needed.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-06-07 08:39:30 +09:00
Akos Kiss 905cd705ef CMakeLists maintenance (#1826)
Removed various superfluous declarations, and rewrote some parts to
be nicer or more consistent.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-06-06 09:08:14 +02:00
Zidong Jiang 11d5402c35 Allow out_native_pointer_p in jerry_get_object_native_pointer to be NULL (#1876)
Support those cases when the existence of the native property is checked.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-06-05 10:44:56 +02:00
Daniel Balla 13930a1cd4 Fix exception argument check (#1875)
The If case didn't work properly when 0 was given to the --exception option.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-06-02 12:25:29 +02:00
Daniel Balla 5eb00b7ae0 Add command line option to exception and display commands (#1872)
You can now set --display and --exception parameters in the command line.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-06-02 10:40:12 +02:00
Robert Sipka ddbe067dee Set log level to JERRY_LOG_LEVEL_DEBUG when using show-opcodes on nuttx-stm32f4 target (#1869)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-06-01 08:51:15 +09:00
Zoltan Herczeg a9e7dd7b91 Check breakpoint stop condition in VM. (#1868)
Check breakpoint stop condition even after a message is processed.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-31 12:53:25 +02:00
Zoltan Herczeg efdc06996b Improve instance management in JerryScript. (#1849)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-31 15:53:53 +09:00
Daniel Balla b17a628c19 Add --color option to python debugger (#1865)
Adding --color option, highligthing the number of lines, the pointer and the actual breakpoint.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-05-31 08:53:55 +09:00
Daniel Balla 712d5ca8b7 Python debugger source & display command (#1850)
Reworked source(src) command to display a given range of the code, defaults to 3.

Added display command which does the same as the source, except it displays the source code everytime a breakpoint is hit.

Made tests for display, extended tests for src.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-05-30 10:58:34 +02:00
Sanggyu Lee ae60ff0aa3 Handle negative zero in number multiplication (#1856)
Keep sign for zero.
For example, 1 / (0 * (-1)) should be -Infinity, not +Infinity.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-05-30 10:57:32 +02:00
László Langó 631e9f9f80 Update the API examples to use print from extensions (#1846)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-05-30 09:59:49 +02:00
yichoi 783dcec6df Add license report and scan status with FOSSA (#1862)
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2017-05-30 16:11:46 +09:00
Jan Jongboom 37ed82437b target: mbedos5: Update to mbed OS 5.4.5 (#1853)
Also ignore the default jerry-port - see also #1847. Re-implement the `print()` function, as it's no longer part of core Jerry, but our programs still depend on it.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2017-05-30 09:09:09 +02:00
fbmrk a8a25e7f3c Update mbedos5 make (#1847)
Fix make clean and ignore jerry-port-default

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-05-30 08:58:03 +02:00
Gabriel "_|Nix|_" Schulhof 708b155f38 Clean up property existence check inconsistencies (#1860)
`jerry_has_property ()` and `jerry_has_own_property ()` are inconsistent
in that they squash their return value into a `bool` when in fact it is
a `jerry_value_t`, thereby giving the wrong impression that a property
is there when it isn't and encouraging the leaking of `jerry_value_t`s
by disguising them as `bool`s.

Fixes https://github.com/jerryscript-project/jerryscript/issues/1859

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-05-29 15:54:32 +02:00
Paul Sokolovsky b51b6824bb targets: zephyr: Reinstate "print" function and error printing. (#1851)
Re-add "print" function following resent refactors when it was moved
from jerry-core to jerry-ext. This is done in particular to keep
detailed messages on errors.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2017-05-25 09:08:34 +02:00
Robert Sipka 557fa5006c Set log level to JERRY_LOG_LEVEL_DEBUG when using mem-stats or show-opcodes (#1848)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-25 15:25:00 +09:00
Gabriel "_|Nix|_" Schulhof de53adbf88 Lazily create a linked list of context items (#1833)
This approach has the benefit that it does not require any *a priori*
initialization, and that each context pointer is identified by the way
in which it was created. Additionally, retrieving the context pointer
now requires that the entity responsible for creating/destroying it
(the manager) be given. Since managers are stored in global static
const structures, they should not normally be visible across source
files, and thus there should be no danger that a context item will be
retrieved by the wrong manager and thus cast into the wrong data type.

Since the items are stored in a linked list, their number will be
limited to exactly as many as are needed for a given context, with the
caveat that storing too many on a context will cause slow retrieval.

Thanks @mhdawson for the idea!

Fixes https://github.com/jerryscript-project/jerryscript/issues/1845

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-05-24 14:10:18 +02:00
Zoltan Herczeg 29f57ec58f Print exception hint in the debugger client when an exception is thrown. (#1841)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-23 16:06:25 +02:00
László Langó 7770b6237a Fix parsing of UTF-8 RegExp literals (#1840)
Fixes #1831

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-05-23 12:04:11 +02:00
Daniel Balla 8894077656 Implement memstats command in the debugger (#1838)
Implementation of memstats command in jerry-debugger, python and html client.
Shows the allocated bytes, byte code bytes, string bytes, object bytes, property bytes and heap size.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-05-23 11:19:15 +02:00
Zoltan Herczeg e58f2880df Do not allocate memory for zero length strings. (#1844)
Fixes #1821.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-22 13:17:08 +02:00
László Langó a504fd0333 Fix character escape in character class parsing of RegExp objects. (#1834)
Fixes #1830

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-05-22 13:01:22 +02:00
Robert Sipka 04f3bf62b0 Set log level to JERRY_LOG_LEVEL_DEBUG when using mem-stats. (#1843)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-22 12:58:40 +02:00
Zidong Jiang eb2af2d2a6 jerryx_arg: add '\0' when transforming string (#1827)
Related issue: #1824

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-05-22 08:32:20 +08:00
Zidong Jiang 5e28bfc28a Support external context, heap and lcache (#1778)
JerryScript should support external context, heap and lcache,
so that it can have multiple instances and runtime configurable heap
size.

Related issue: 1746

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-05-20 11:00:19 +08:00
Zoltan Herczeg c6d890ee13 Support functions with number identifiers in the pre-scanner. (#1837)
Fixes #1829.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-19 14:49:38 +02:00
Imre Kiss 833796a20f Fix the getBreakpoint() function in the HTML Debugger client. (#1839)
There was a problem around the offset, the function tried to use some invalid object reference.

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi.szeged@partner.samsung.com
2017-05-19 14:38:19 +02:00
Daniel Balla ffdf151387 Fix a typo in a variable name (#1835)
There was a typo in a variable name causing the build to fail when mem-stats was turned on.

JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
2017-05-19 10:03:02 +02:00
Levente Orban d48c65d258 Add pending breakpoints feature to HTML (JavaScript) Debugger client (#1828)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-05-19 09:50:17 +02:00
Zsolt Borbély 7833270ca0 Initialize an array in test-ext-arg.c (#1824)
In case of some compilers (e.g. gcc-4.9, gcc-5.4) the `TEST_ASSERT (arg3[4] == '\0')`
fails in test_validator1_handler() due to uninitialized memory fields.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-05-18 15:20:44 +02:00
Akos Kiss 23068bdf99 Move the job queue from the ports into jerry-core (#1804)
* Move the job queue from the ports into jerry-core

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu

* Remove port notification and keep `jerry_run_all_enqueued_jobs` API only

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-18 18:30:50 +09:00
Levente Orban 0806c16902 Add pending breakpoints feature to python debugger client (#1810)
- Support to add pending breakpoints
 - Add fbreak command for the prompt
 - Manage this breakpoints
 - Add tests for it

JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-05-18 09:00:38 +02:00
Akos Kiss 31cd3b8020 Rename internal lit identifiers (#1801)
We should keep the `jerry_` prefix for public API which is either
declared in jerry-core/include or implemented in jerry-core/api.
Moreover, we should also keep the convention to use short
identifiers for componentization within jerry-core, and use these
identifiers as directory names, file name prefixes, and identifier
prefixes.

Therefore, the tools/gen-unicode.py-generated arrays in
jerry-core/lit are renamed to use `lit_` prefix instead of `jerry_`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-16 10:34:41 +02:00
Akos Kiss 7837440cbb Add lightweight command line processor to jerry-main (#1809)
Eases command line option and sub-command definition, usage summary
and detailed help message printing, and argv processing.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-16 10:29:27 +02:00
Sanggyu Lee 1501699f48 Add setjmp and longjmp functions for tizenrt-artik05x (#1825)
This patch is based on nuttx-stm32f4 implementation.
However, I removed vldm and vstm since artik05x has no FPU.
It fixes the following error on running some testcases under tests/jerry/fail:

System Information:
        Versionarm_dataabort:
        Data abort. PC: 0410d9d8 DFAR: 0a00001d DFSR: 00000008
        up_assert: Assertion failed at file:armv7-r/arm_dataabort.c
        line: 111 task: appmain

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-05-16 09:57:32 +02:00
Zoltan Herczeg f4fbf0b0b5 Rework memory statistics to provide useful user information. (#1812)
Obsolote statistics is also removed.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-16 09:52:12 +09:00
Zoltan Herczeg f5b385ca6c Tracking variables to reduce the memory consumption of scope chain. (#1819)
Currently we keep all local variables in the scope chain as long as
a nested function is alive. These variables consume memory although
several of them are never used. This patch focuses on removing those
unused ones whose can be detected at parsing time.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-15 09:00:57 +02:00
Sanggyu Lee 8143a0cc10 Use external handlers in tizenrt-artik05x target (#1822)
This patch includes followings:
- Use external handlers in jerry-ext.
- Make jerry_main similar to other ports. (including options)
- Merge jerry_port.c into jerry_main.c
  jerry_port is clearly out of jerry-core.

This patch not included following:
- Use jerry-libm, instead of system libm.
  It is already included.
  We choose to use jerry-libm since the result of cube-3d sunspider was inaccurate
  when using NuttX libm.
- Correct setjmp/longjmp implementation.
  I tried to bring the source from NuttX port.
  Unfortunately it does not work in tizenrt-artik05x as it is.
  I will take a closer look the code and make sure it works.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-05-15 15:41:06 +09:00
Zsolt Borbély ca6e7881e8 Add category property to each .md file for the webpage (#1818)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-05-12 15:34:46 +02:00
Sanggyu Lee 91b06726bb Include jerry-ext/handler only in nuttx-stm32f4 target (#1816)
I included jerry-ext/handler only, rather than including all in jerry-ext.
Currently only handler is used in nuttx-stm32f4 repl.
nuttx.bin binary size is reduced from 231576 to 230456 bytes.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-05-12 15:17:11 +02:00
Levente Orban 0066e526f7 Increase verbosity when breakpoints not found in HTML client (#1817)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-05-12 11:36:56 +02:00
Zsolt Borbély e76d44a2ee Add docs about extensions to webpage-generator script (#1811)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-05-12 09:51:00 +02:00
Robert Sipka 2b152f079a Use external print handler in riot-stm32f4 target (#1814)
Extend example code with registering the `print` function in the global object.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-11 20:46:14 +02:00
Zoltan Herczeg 838e74df0f Remove include jerryscript.h from jrt.h. (#1803)
Fixes #1791.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-05-11 12:42:47 +02:00
Robert Sipka 7d133e55e4 Use external print, gc and assert handlers in nuttx-stm32f4 target (#1813)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-05-11 07:26:10 +02:00
fbmrk 1a7b258772 Set JERRY_JS_PARSER to 1 in mbed_app.json (#1808)
JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
2017-05-10 17:14:24 +09:00
Akos Kiss a8f2d31bca Implement common external function handlers in jerry-ext (#1787)
Added `handler` module to `jerry-ext` to contain implementation of
commonly used external function handlers: `assert`, `gc`, and
`print`.

Also adapted jerry-main to use jerry-ext/handler

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-09 10:16:56 +02:00
Akos Kiss 68f9585b96 Fix jobqueue's return value handling in jerry-main's repl mode (#1807)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-09 12:40:53 +09:00
Akos Kiss 7f32abf75c Remove limitation on number of command line arguments in jerry-main (#1806)
Since JerryScript has been a C99 project for a while now, we can
use variable-length arrays. This allows the removal of the
artificial limit on command line arguments in jerry-main.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-09 12:40:37 +09:00
Akos Kiss 59c7ffe363 Shouldn't use jerry_value_t in ecma-exceptions.c (#1800)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-07 21:46:15 +02:00
Akos Kiss 91e976f8c7 Move jerry-core API implementations and headers into dedicated subdirectories (#1793)
Moved all public API headers under the `jerry-core/include`
directory. This makes installing all the public headers easier.
Also, should we have new public headers in the future, their
installation will be automatic, there will be no need to update the
build files. Moreover, this aligns better with the structure of
other libraries in the project (in those cases, public headers
always reside in `<library>/include`).

Moved all public API implementations under the `jerry-core/api`
directory. This cleans up the root directory of `jerry-core`,
moving all implementation code under "modules", i.e.,
subdirectories. This also makes the future splitting of the big and
monolithic `jerry.c` along features easier, if needed. (Debugger
and snapshot-related functions are already in separate sources.)

Notes:
* `jerryscript.h` is split up to separate header files along
  feature boundaries. These new headers are included by
  `jerryscript.h`, so this is not a breaking change but header
  modularization only.
* `jerry-snapshot.h` is still under `jerry-core/api`, keeping it as
  a non-public header.
* This commit also adapts all targets to the include path change.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-04 15:28:24 +02:00
Zidong Jiang 90efdf9c8b A tool in jerry-ext: arg transformer for binding (#1740)
It provides some APIs for binding developers, so that
they can validate the type of the js argument and convert/assign them
to the native argument.

Related Issue: #1716

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-05-04 18:00:35 +08:00
Zidong Jiang ede13835b2 Add promise C API (#1796)
Add API: jerry_create_promise, jerry_value_is_promise and jerry_resolve_or_reject_promise.

related issue: 1794

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-05-04 16:13:26 +08:00
Akos Kiss 240411771a Remove the built-in print and the jerry_port_console port API functions (#1749)
The built-in `print` is removed from jerry-core, but an external
`print` implementation is added to jerry-main. From now on, all
embedders of the engine have to implement their own `print` if they
need such a functionality.

For printing results in REPL mode of jerry-main, the external
`print` handler is called directly instead of looking up the `print`
function registered into the global object. (The two are the same,
but the indirection is not needed anymore.)

Because jerry-core does not contain `print` anymore,
`jerry_port_console` is removed from the port API. The default port
is updated, i.e., the implementation of `jerry_port_console` is
removed. Additionally, all references to `jerry_port_console` in
jerry-main are replaced by `printf`.

Speculatively, `jerry_port_console` is also removed from all
non-default targets. Most targets implemented it for the sake of the
engine only; in those targets the removal was trivial. Where the
function was called from the embedder application as well, the
calls were replaced with equivalents (e.g., `printf`, `printk`).

NOTE 1: This is a breaking change!

NOTE 2: This patch still leaves several targets without a JS `print`
implementation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-03 11:47:56 +02:00
Akos Kiss 3705bf19d0 config.h maintenance (#1792)
The config header was full of legacy, no-longer-in-use defines. It
was also included from multiple files where it was not necessary.
This patch removes the unused defines, and cleans up headers so
that only `ecma-globals.h` includes `config.h`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-05-02 08:44:57 +02:00
Zoltan Herczeg 894aa6d036 Support ECMAScript stopping in JerryScript. (#1753)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-04-28 14:19:23 +02:00
Robert Sipka 0e38356e5b Update riot-stm32f4 target to use jerry-port-default-minimal (#1790)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-28 10:49:39 +02:00
Robert Sipka 56802c22a1 Remove unnecessary subfolder in tests/jerry/fail/ (#1783)
There is no need to create error code named subfolders since
every failing tests return with the same code.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-28 09:17:23 +02:00
Zidong Jiang 14c455bcd8 [native pointer] Check if freecb is NULL before calling it (#1789)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-04-28 09:01:40 +09:00
Akos Kiss 6ecee7eef4 Ensure that jerry-port is license-checked (#1788)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-28 08:59:10 +09:00
Sanggyu Lee c9dac6a720 target: tizenrt-artik05x: Add missing jerry_port.c (#1786)
Add missing jerry_port.c in previous initial port.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-04-27 10:25:29 +09:00
Robert Sipka fb432a8bd7 Eliminate pylint warnings from generate_pins.py (#1731)
It also contains small refactoring steps:

* Added a main() function - instead of just writing all the code into the
  "if name" block - to avoids creating global variables that could affect
  other functions.

* Added a `write_pins_to_files` function - which writes the generated pins
  into the output JS and C++ files - to avoid too many local variables.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-26 15:18:20 +02:00
Zidong Jiang 078f6e101d Implement other routines of Promise (#1729)
Add Promise.resolve, Promise.reject, Promise.race, Promise.all and
Promise.prototype.catch

Also it fixes the issue 1763

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-04-26 19:47:51 +08:00
Levente Orban 9d4123c3c4 Fix the exception handler bug (#1780)
If the debugger evaluate a variable out of the scope in eval mode, its get an error.

JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-04-26 20:29:16 +09:00
Akos Kiss 8aca0acaa1 Aftermath of PRs #1505 and #1755 (#1771)
PR #1505 added support for TI compiler. It explicitly added a
message to notify the user that static linking is forced. PR #1755
added a more generic approach to signal such forced settings and
adapted the TI-specific static linking notification to this
approach. However, it turned out that TI forcibly changed another
setting, too: it disabled release binary stripping, but without
notification. This patch fixes this by moving the setting override
to a consistent place and adding a notification.

PR #1505 also added some source code changes, most importantly a
complex struct initialization for a variable in
`ecma-objects-general.c`. However, that initialization was coded
as a macro to trick the style checker. This patch gets rid of that
macro and uses proper C99 struct initializer with designators.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-26 12:53:41 +02:00
Sanggyu Lee e8be1984bb target: tizenrt-artik05x: Initial porting (#1775)
Initial porting to tizenrt-artik05x.

Tizen RT is a lightweight RTOS-based platform to support low-end IoT devices.
The project is under developing in github TizenRt repo.
Artik05x is an IoT SoC solution that will be released soon.

This PR contains the minimum porting that can print Hello
world from jerryscript and a document for building and running.

I used jerry_port.c and jerry_main.c in nuttx port and default port for
porting base code. Also I used Make.defs and Makefile in working
example in tizenrt for adding jerryscript configuration.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-04-26 11:19:14 +02:00
Akos Kiss d48db1d5bd Remove jerry-internal.h (#1782)
The internal header was a legacy, declared two functions only. One
of them was not used anymore at all, the other was used at a single
call site. Moreover, their documentation was outdated. This patch
removes the header and the related function implementations -- as
well as the temptation to use such internal functions from outside
the library.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-26 08:05:33 +09:00
Akos Kiss fdbbd0e8af Turn port implementations into proper libraries (#1777)
This commit changes the concept of JerryScript port implementations
from a simple directory of C source files (which get injected among
the sources of `jerry-core`) into a proper static library (which
may be linked to an application together with `jerry-core`). As a
consequence, this commit introduces a new library to the
JerryScript component architecture: the sources of the default port
implementation form `jerry-port-default`.

Changes in more detail:

- The sources in `targets/default` are moved to `jerry-port/default`
  and are turned into a proper static library.
  - Actually, the default port implementation has two library
    variants, one that implements the bare minimum only
    (`jerry-port-default-minimal`) and one that has some extra
    functionalities specific to this implementation (the "full"
    `jerry-port-default`).
  - The new libraries have an interface header in
    `jerry-port/default/include`, which extends the common
    `jerryscript-port.h` API with functions specific to these
    libraries.
  - All non-standard port functions have now the
    `jerry_port_default_` prefix (this affects `jobqueue_init` and
    `jobqueue_run`).
  - The jobqueue implementation functions became config macro
    independent: it is now the responsibility of the linker to pick
    the needed objects from the library, and omit those (e.g.,
    jobqueue-related code) that are not referenced.
  - Build of the libraries can be controlled with the new
    `JERRY_PORT_DEFAULT` cmake option.

- The cmake option `PORT_DIR` is dropped, and `PORT_DIR/*.c` is not
  appended to `jerry-core` sources.
  - Instead, the `jerry` tool of `jerry-main` links to
    `jerry-port-default`, while `jerry-minimal` links to
    `jerry-port-default-minimal`.
  - `tests/unit-core` tests are also linked to
    `jerry-port-default-minimal`.

- Tools adapted.
  - `build.py` has `--jerry-port-default` instead of `--port-dir`.
  - `check-*.sh` have paths updated (`jerry-port/default` instead
    of `targets/default`).

- Miscellaneous.
  - Dropped `#ifndef`s from `jerryscript-port.h`. It is a public
    header of the `jerry-core` library, which means that it must
    not contain configuration-dependent parts (once the library is
    built with some config macros and the archive and the headers
    are installed, there is no way for the header to tell what
    those config macrose were).
  - Added documentation comments to the JobQueue Port API (in
    `jerryscript-port.h`) and to several default port
    implementation functions (in `jerry-port/default`).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-25 19:33:10 +02:00
Akos Kiss 49ae946644 Merge lit-unicode-*.inc.h-related generator scripts (#1767)
The `conversions` and `ranges` files had separate generators, which
shared some functionality through a 3rd python module, and were
quite similar to each other -- but also had some differences.
Moreover, as they were separate scripts, nothing forced to keep the
outputs in sync (to re-generate them at the same time from the same
inputs).

To fix these maintainability issues, this patch
- merges the two python files and part of the 3rd utility module
  into a single script while keeping the existing functionality,
- names the new file `gen-unicode.py` to align better with other
  generator script in `tools`, and
- adds some extra documentation how to retrieve the input files
  (as they are not part of the repository).

The refactoring affected the utility module as well, so this patch
also
- renames `c_source_helper.py` to `gen_c_source.py` (again, for
  naming consistency),
- reorganizes some of its functions not to export module-local
  helper functions, and
- adapts `js2c.py`, as it also uses this utility module.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-25 07:22:05 +09:00
Martijn Thé 1f6b396ebb bugfix: jerry_get_object_native_pointer: accept NULL for out_native_info_p (#1770)
With the jerry_set_object_native_pointer() the native_info_p is optional, so I think it makes sense that it is optional for the getter as well.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2017-04-24 13:52:00 +02:00
Zsolt Borbély 07c86ece54 Fix alignment in case of enabled 32bit compressed pointers (#1764)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-24 13:02:14 +02:00
Martijn Thé 849ea45cc2 Improve documentation for jerry_get_object_native_pointer API (#1769)
Based on feedback I got from people who tried using the new API, it was not immediately clear how to properly use it.
Hopefully these doc additions make it more clear how to use it and why it is designed the way it is.
Also fixed some mistakes in the example and provided more comments to explain the intent of the code.

JerryScript-DCO-1.0-Signed-off-by: Martijn The martijn.the@intel.com
2017-04-24 10:40:24 +02:00
Sanggyu Lee acf88d2fe8 Fix maybe-uninitialized warning in ecma-objects.c (#1773)
During building jerryscript with arm-gcc-noneeabi 4.9.3,
maybe-uninitialized warning occurred. This patch fixed the warning.

JerryScript-DCO-1.0-Signed-off-by: Sanggyu Lee sg5.lee@samsung.com
2017-04-24 10:08:13 +02:00
Akos Kiss 4f4f75e1a8 Update paths in check tools (#1772)
In #1761, not all unit test paths have been updated in check tools.
This triggers no errors as `check-vera` emits a warning only while
`check-cppcheck` signals nothing. Still, this means that some of
the code in the repository that has been quality-assured, is now
avoiding checks. This patch fixes this.

Moreover, `check-cppcheck` has had incorrect paths for a while: it
looked for source files in the root of the repository, but those
files have been in `jerry-main` for almost a year now. This patch
fixes this, too.

Fallout of the above: `main-unix-minimal.c` had to be improved to
make `check-cppcheck` pass.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-24 09:01:03 +09:00
Akos Kiss 0ab099b787 Add JERRY_FEATURE_DEBUGGER to API docs (#1768)
In #1738, `JERRY_FEATURE_DEBUGGER` was added to the sources, but
the docs were not updated.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-24 09:00:21 +09:00
Akos Kiss 6ca8319aea Split unit tests into separate directories (#1761)
The unit tests should follow the component structure, so this patch
moves all `jerry-core` unit tests under `tests/unit-core` and the
`jerry-libm` unit tests under `tests/unit-libm`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-22 10:57:45 +09:00
Akos Kiss 66ade0d81c Add Python wrapper for the HTML-based debugger (#1736)
The patch aims at easing the startup of the HTML-based JerryScript
debugger client by adding a python script that starts the default
browser with the HTML page implementing the debugger client.
Additionally, the pyton script encodes the host:port address
information of the debug server in the file url and the HTML client
is extended to retrieve this information. Thus, both the console
and the browser-based debugger client can be started similarly.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-22 10:55:39 +09:00
Akos Kiss 6c3a6e7be3 Rename jerry-port.h to jerryscript-port.h (#1762)
All public headers should follow the pattern `jerryscript[-*].h`.
The `jerry-api.h` to `jerryscript.h` renaming has already happened
a while ago, now it's time for the port API header to follow.

This patch
* renames the public header file,
* updates all includes to use the new file name (in `jerry-main`,
  in all the targets, and in the docs), and
* keeps `jerry-port.h` as a deprecated forwarding header to leave
  some time for external users to follow up with this change.

As a related change, the header of the default port implementation
is also changed to `jerryscript-port-default.h`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-22 10:53:12 +09:00
Zidong Jiang 63b6fd1bc9 Add the class name of promise.prototype (#1766)
Fix Issue: 1765

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-04-22 08:34:42 +08:00
Akos Kiss 67c641e567 Generate lit-magic-strings.inc.h (#1690)
Currently, `lit-magic-strings.inc.h` is manually maintained. This
has several drawbacks:

- keeping the list of magic strings sorted first by length then
  alphabetically is error prone,
- it is easy to leave unused magic strings in the list by accident
  (e.g., `LIT_MAGIC_STRING_JERRY_UL` is defined as a magic string
  but not used anywhere in the code) and,
- it is very hard to add `CONFIG_DISABLE_*_BUILTIN` guards to the
  list, even though there are several magic strings, which are used
  in some of the configurations only (e.g, "setPrototypeOf" is used
  in ES2015 only).

To ease the maintenance of magic strings, this commit moves the
definition of magic strings to a config file
(`lit-magic-strings.ini`), and adds `tools/gen-magic-strings.py` to
generate the `.inc.h` file from this config file and from the use
cases of the strings in the code.

- The magic strings in the config file can appear in any order, the
  generator will ensure that they are correctly sorted.
- The generator skips those definitions that are not used anywhere
  (and emits a warning to signal that such definitions can be
  removed).
- The generator applies the same guards to the definitions in the
  `.inc.h` file as found in the code around the use of the strings
  to optimize for size.

The commit also changes some builtin-related `.inc.h` files by
adding guards that don't affect functionality but improve the
results of the generator.

To ensure that the invocation of the generator does not get
forgotten, the commit also adds `tools/check-magic-strings.sh` and
binds it into the testing infrastructure.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-21 11:42:36 +02:00
Roland Takacs 5231829fc9 Enable dummy time zone in nuttx-stm32f4 target. (#1760)
JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com
2017-04-21 18:09:11 +09:00
Akos Kiss d93bc3a849 Make string handling in debugger more pythonic (#1757)
* `to_string` is unpythonic, let's use `__str__` instead.
* `\"%s\"` for strings is also unpythonic, let's use `%r`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-21 09:52:06 +09:00
Akos Kiss 4cff7a3f2c Fix/rewrite/darwinize test runner of jerry-debugger (#1756)
First issue was that `diff -u0` was not supported on OSX, thus got
replaced by `-U0`. Then, it turned out that test outcome was
determined based on diff's stdout, which was empty even though the
exit code was non-0 - this got changed, too.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-21 09:51:31 +09:00
Akos Kiss 84f0279289 Allow platforms/compilers to signal that user-specified settings are overridden (#1755)
Currently, the Darwin platform and the TI compiler force some of
the settings to predefined values. This patch ensures that these
overrides are highlighted during build.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-21 09:49:46 +09:00
Robert Sipka 5271214623 Support error messages on nuttx-stm32f4 target (#1754)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-21 09:48:58 +09:00
Akos Kiss 2ebb8de3ab .gitignore maintenance (#1758)
* OSX Finder leaves `.DS_Store` files around; make them ignored.
* The mbedk64f target has been renamed to mbed a long time ago;
  follow that change in .gitignore, too.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-21 09:45:09 +09:00
Akos Kiss ea44b3b44c Refactor the command line option handling of the jerry tool (#1745)
The file `main-unix.c` contained a lot of recurring patterns in the
command line option handling parts. This patch removes these code
clones with the introduction of two helper functions. The goal of
the patch is to have a smaller and maintainable `jerry` tool (mostly
source-wise).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-20 15:12:10 +02:00
Akos Kiss 2424ba71f2 OSX-related CMakeLists maintenance (#1750)
Disable release binary stripping on OSX: The linker of OSX does not
support `-s` for link-time stripping. (The option does not cause an
error but clutters build output with warnings.)

No OSX-dependent LTO flags: LTO is disabled on OSX.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-20 19:42:13 +09:00
Zsolt Borbély fda5924b06 Rename the doc of coding standard and add it to the update-webpage.sh (#1748)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-20 12:23:53 +02:00
Zsolt Borbély 2fa9ae8d64 Fix link-generation in tools/update-webpage.sh (#1747)
This change is required to fix invalid links in 'See also' sections.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-19 13:48:42 +02:00
Zsolt Borbély befa7a88fe [nuttx-stm32f4] Use jerry-libm instead of the math library in NuttX (#1744)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-19 10:22:48 +02:00
Robert Sipka 8d99e73db3 Add setjmp and longjmp functions for nuttx-stm32f4 target. (#1743)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-19 07:10:05 +09:00
Robert Sipka 9cbd5e78ad Refactor js2c.py and eliminate related pylint warnings (#1728)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-19 07:08:32 +09:00
yichoi 67d5df2735 Update mailing list information (#1742)
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2017-04-18 20:58:09 +09:00
Zsolt Borbély 5449b0f40b Always define debugger-related opcodes (#1734)
This change makes the generated snapshot independent from buildconfig.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-18 18:20:20 +09:00
Akos Kiss 0f4edbe580 Ensure that const and pure function attributes are used properly (#1739)
Some functions were incorrectly marked as const but were pure only
(or not even pure). Some functions were marked as pure but
qualified as const. Some functions were not attributed at all but
qualified either as pure or const. Some functions had attributes
at definition but not at declaration. This commit fixes these
inconsistencies.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-18 17:15:34 +09:00
Akos Kiss dc1dc093d9 Add JERRY_FEATURE_DEBUGGER (#1738)
Until now, it was not possible to query the engine whether its
build configuration contained debugging support. This commit adds
the `JERRY_FEATURE_DEBUGGER` label to `jerry_feature_t` and extends
`jerry_is_feature_enabled` to support the new feature flag.
Additionally, the command line tool `jerry` was enhanced to report
a warning when invoked with `--start-debug-server` but linked to a
non-debuggable engine.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-18 17:15:13 +09:00
Tomasz Wozniak 42206d27c8 Janitorial: add missing integer cast to remove compiler warning. (#1720)
JerryScript-DCO-1.0-Signed-off-by: Tomasz Wozniak t.wozniak@samsung.com
2017-04-17 11:30:18 +09:00
Gabriel "_|Nix|_" Schulhof b4a3985560 Support a user context void * pointer in jerry_context_t (#1717) (#1727)
This modification makes it possible to initialize a context in such a
way that a `void *` pointer is stored inside the context and is made
available via a new `jerry_get_user_context()` API.

The pointer is initialized via a new `jerry_init_with_user_context()`
API, which calls the existing `jerry_init()`, after which it sets the
value of the new `user_context` element in the `jerry_context_t`
structure using the context allocation callback provided as the second
parameter to the new `jerry_init_with_user_context()` API. The location
of the cleanup function responsible for deallocating the pointer created
by the context allocation callback is provided as the third parameter.
This location is stored in the context along with the pointer itself.

When a context is discarded via `jerry_cleanup()`, the user context
cleanup function is called to dispose of the pointer stored within the
context.

The semantics behind the API are such that it is now possible to choose
for each context an agent which manages arbitrary user data keyed to the
given context. The agent must be chosen at context instantiation time
and cannot be changed afterwards, remaining in effect for the lifetime
of the context.

Fixes #1717

JerryScript-DCO-1.0-Signed-off-by: Gabriel Schulhof gabriel.schulhof@intel.com
2017-04-14 08:25:29 +08:00
Akos Kiss 4b9e458f44 Add support for init/fini arrays to libc (#1725)
The arrays contain the addresses of functions annotated with
constructor or destructor attributes. The support is optional,
requires FEATURE_INIT_FINI cmake option to be set. As of now, the
option is _not_ available in tools/build.py directly, only via
`--cmake-param="-DFEATURE_INIT_FINI=ON"`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-04-13 17:18:17 +02:00
Zsolt Borbély 950a0f10cd Fix a few issues which can lead to undefined-behaviour (#1730)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-13 21:34:10 +09:00
Robert Sipka 605e9847d2 Add testing support for nuttx-stm32f4 target (#1733)
Provide the 'assert' and 'gc' implementation for the engine.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-13 14:09:31 +02:00
Robert Sipka 95809cd977 Buildfix for nuttx-stm32f4 target (#1732)
The `jerry_port_jobqueue_enqueue` function is undefined on this target.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-13 20:47:00 +09:00
Zoltan Herczeg 239ae4963c Add documentation about the Coding Guidelines (#1459)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-04-13 16:53:07 +09:00
Zidong Jiang eb8dd4602b Implement the basic Promise (#1695)
Implement the Promise Constructor and routine: 'then'

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-04-12 22:10:08 +08:00
Zoltan Herczeg 01fe5ab190 Small improvements for type property support. (#1724)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-04-12 15:05:29 +02:00
Levente Orban a83319cfa1 Fix the stlink binary path (#1726)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-04-12 14:45:58 +02:00
David Brown 5481fca060 Fix .gitignore syntax (#1721)
Change instances of **.ext in the .gitignore to just *.ext.  I think
the intent was to match these patterns in any directory, which is what
will happen with simple patterns.  The '**' construct is meant to
match zero or more full paths, but it must be the sole component of
the path.

Discovered by a warning from ripgrep.

JerryScript-DCO-1.0-Signed-off-by: David Brown david.brown@linaro.org
2017-04-11 13:28:05 +02:00
Zidong Jiang e522e740a7 Add 'type' argument to set/get native handle API (#1711)
Ecma-object have native handle type inside, and binding code could use
type info to validate native handle's type.

Related issue #1681

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-04-10 16:51:37 +08:00
Zsolt Borbély 574dff512e Remove duplicated profile-check from build.py (#1718)
This check is performed in cmake-side too.
The README.md about the profiles is also updated.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-07 18:47:22 +02:00
Zsolt Borbély 69f03475b2 Add the directory of test262 tests to .gitignore (#1719)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-07 17:03:38 +02:00
Zoltan Herczeg 13b305f716 Refactoring several array buffer and typed array functions. (#1715)
The ecma_typedarray_create_object_with_typedarray function is fully rewritten.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-04-07 11:20:03 +02:00
Robert Sipka 1886d54474 Update unicode ranges to the latest version of Unicode Standard (version 9.0.0) (#1714)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-06 10:07:17 +02:00
Zsolt Borbély 5d950ccb05 Remove unused functions (#1710)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-04 10:49:47 +02:00
Zsolt Borbély db22169293 Fix wrong condition in vm.c (#1708)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-04-03 15:21:34 +02:00
Zoltan Herczeg 1aec439869 Mark target_function of bound objects. (#1707)
Fixes #1621.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-04-03 13:05:29 +02:00
Levente Orban a5b90ed858 Add minor features to debugger html client (#1705)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-04-03 12:36:48 +02:00
Robert Sipka 5f24620c8a Fix helper function for rounding numbers (#1702)
Fixes #1701

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-03 08:44:46 +02:00
Robert Sipka f0a7e2456a Add coverity scan (#1700)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-04-03 08:44:30 +02:00
Levente Orban efa7975ce9 Fix pylint warning in debugger python client (#1704)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-31 10:48:40 +02:00
Levente Orban 5525f5241d Bug fix for the debugger python client 'quit' command (#1703)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-31 08:34:40 +02:00
Zoltan Herczeg 750e0ca9d5 Fix several style fixes for typed arrays and optimize filter a bit. (#1697)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-03-30 16:06:11 +02:00
Zidong Jiang 41c63e08b1 Combine ARRAYBUFFER and TYPEDARRAY macros together (#1699)
Change CONFIG_DISABLE_ES2015_ARRAYBUFFER_BUILTIN to
CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
Because typedarray depends on arraybuffer and it doesn't make sense to
enable arraybuffer only.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-03-30 21:22:22 +08:00
Robert Sipka 3ff9a7de8a Fix the number of copied bytes in memmove (#1698)
Fixes #1634

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-03-30 10:40:05 +02:00
Levente Orban 20466a7637 Add missing test for debugger (#1692)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-30 10:29:32 +02:00
Zoltan Herczeg 343bac56b2 Add C-API for the debugger. (#1688)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-03-29 12:46:07 +02:00
Akos Kiss 2d9484a968 Don't do duplicate builds during test runs (#1691)
The `run-tests.py` test execution harness validates the correctness
of JerryScript by building various configurations of jerry and
running various test suites and subsets against it. However, until
now, it always built jerry for each (build configuration, test suite)
pair. This commit improves `run-tests.py` by skipping duplicate
builds, sharing the same-built binaries across multiple test suite
runs.

The patch also improves on the style of how `Option`s are specified
and fixes the name of the `jerry_tests-debug-cpointer_32bit`
option.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-03-28 15:48:09 +02:00
Zidong Jiang 16d5d6f79d Add a simple Job queue in default port. (#1685)
Job queue (event loop) is the basis of Promise. Each port should implement their own job queue.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-03-28 21:15:01 +08:00
Levente Orban 21cec3eb16 Add Stop at exception feature to the debugger (#1693)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-28 12:51:10 +02:00
Akos Kiss da07252c45 Sort minimal profile (#1689)
Profiles used to be in alpha order. However, after the recent
`CONFIG_DISABLE_[ES2015_]*_BUILTIN` renamings, the minimal profile
became unsorted. This commit re-sorts the file.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-03-27 11:01:05 +02:00
Robert Sipka faa9655981 Add asserts to avoid the access of cbc_flags and cbc_ext_flags arrays outside of their bounds (#1686)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-03-24 11:30:41 +01:00
Levente Orban c09ba8cdb3 Rename 'CONFIG_DISABLE_ARRAYBUFFER_BUILTIN' to 'CONFIG_DISABLE_ES2015_ARRAYBUFFER_BUILTIN' (#1687)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-24 11:30:23 +01:00
Zidong Jiang 8571ebfae5 Implement %TypedArray%.from and fix the issue #1670 (#1679)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-03-24 10:37:22 +01:00
Levente Orban f50193111b Rename 'CONFIG_DISABLE_TYPEDARRAY_BUILTIN' to 'CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN' (#1683)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-24 08:06:03 +01:00
Robert Sipka 0807c97cbb Eliminate duplicated statements in re-parser.c (#1680)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-03-23 16:20:32 +01:00
Péter Gál 013430aafb Fix minor inconsistencies in the API documentation (#1663)
In the jerry_set_prototype part the method was described
as jerry_get_prototype. Minor typo fix.

The usage of jerry_set_property was incorrect. Each
call to the jerry_set_property returns a value which must be freed.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-03-23 15:50:24 +01:00
Akos Kiss 4a5df52aa1 Factor out common macro un/definitions used for built-in descriptions (#1678)
The default definitions and undefinitions of macros used for built-in
descriptions (SIMPLE_VALUE, NUMBER_VALUE, STRING_VALUE, OBJECT_VALUE,
ROUTINE, ACCESSOR_READ_WRITE, ACCESSOR_READ_ONLY) are heavily cloned
all over the builtin-objects directory. This commit factors them out
into two header files, which are then included in the place of the
clones. This way, maintenance becomes a lot easier: e.g., if a new
macro gets introduced, default definition and undefinition don't have
to be added to all description files (of which there are 56 right now,
and their number will most probably just grow).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-03-23 09:36:29 +01:00
Zsolt Borbély 852a6aef53 Minor fixes around the debugger (#1677)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-03-23 09:08:06 +09:00
László Langó fa5d5febcc Fix several pylint warnings. (#1659)
Fixed all of the remaining warnings in 'build.py', 'run-tests.py' and 'check-license.py'.

Related issue: #1600

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-03-22 15:37:55 +01:00
Robert Sipka 78e4dcf6c2 Build fix for 32-bit float ecma-number storage (#1669)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-03-22 14:18:43 +01:00
Akos Kiss 6ddf00a9fa Fix comments of ecma_lexical_environment_type_t (#1676)
The comments of `ecma_lexical_environment_type_t` document why the
values of the enum are as they are, while referring to
`ecma_object_type_t`. However, they became out of sync lately and
refer to nonexistent enum labels and/or incorrect values. This
commit gets the two enums in sync.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-03-22 11:36:44 +01:00
Akos Kiss 20a21a1faf Unify timeout mechanism in test runners and ensure that they work on OSX (#1672)
On OSX, the traditional GNU `timeout` command is available as
`gtimeout`. So, this commit adds some logic to the test runners to
try and find the right command name on the host.

Moreover, the commit also unifies the timeout mechanism across all
test runners by rewriting occurrences of `ulimit`-based timeouting
to use the `[g]timeout` command.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-03-22 10:51:37 +01:00
Robert Sipka 7e1ade3406 Remove logically dead code (#1674)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-03-22 10:17:12 +01:00
Levente Orban 4420401cf5 Style fix: return value comments (#1668)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-21 10:24:54 +01:00
Akos Kiss e66bb5591d Implement Object.setPrototypeOf from ES2015 specification (#1666)
`Object.prototype.__proto__` has been implemented by most JS
engines to give R/W access to prototype chains, well before it made
it into the standard. JerryScript has decided not to implement it,
exactly because it was not part of ES 5.1. The only fully
ES5.1-compatible way of accessing the prototype chain is
`Object.getPrototypeOf` for reading.

However, ES2015 defines `Object.setPrototypeOf` for rewriting the
prototype chain, and JerryScript has now an ES2015 subset profile.
So, this commit adds its implementation to JerryScript.

Note, this commit does _not_ add `Object.prototype.__proto__`,
since that is in the Annex B of ES2015 specification, which is
optional for non-web-browser hosts.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-03-21 10:11:07 +01:00
Levente Orban 868ba92e02 Add more tests for the remote debugger (#1667)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-20 12:38:04 +01:00
Gabor Loki dd7e20c85d The mbed ports used wrong time computations for the (#1642)
'jerry_port_get_current_time' function. Microseconds was used instead of
milliseconds.

A quick fix has been done in the Yotta-based mbed port, and an extended one
- with correction - works in the mbed OS 5 port now.

JerryScript-DCO-1.0-Signed-off-by: Gabor Loki loki@inf.u-szeged.hu
2017-03-17 08:35:14 +01:00
Robert Sipka 23ac60915f Modify the snapshot API functions to expect a 32-bit aligned buffer pointer (#1655)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-03-17 09:01:59 +09:00
Levente Orban 05bb5d7890 Improve the debugger python client messages (#1654)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-17 09:01:10 +09:00
Akos Kiss edadc53def Fix Date objects' YearFromTime helper for out-of-range time values (#1658)
For negative out-of-range time values, ecma_date_year_from_time
fell into an infinite loop. (Moreover, for positive out-of-range
time values, it returned an incorrect year.) This patch fixes the
helper to return NaN in these cases (and ensures that its call
sites are prepared for NaN values).

Fixes #1657.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-03-16 17:03:42 +01:00
Robert Sipka d77d4ae1c6 Refactor the generator scripts for unicode tables (#1623)
Extract the source code generator methods into a separated `unicode_c_source.py` script.
Fix the generator scripts to make them compatible with both Python2 and Python3.
Remove pylint warnings.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-03-16 09:32:18 +01:00
Robert Sipka 818c9cd0b0 Fix issue #742 (#1650)
It is a workaround fix. The problem comes from the inaccuracy of the double rounding.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-03-16 08:59:48 +01:00
László Langó 202a88bbeb Temporarily disable a few test262 tests in automatic testing. (#1662)
Those tests are related the actual daylight saving adjustment.
Related issue: #1661

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-03-14 15:26:56 +01:00
Zoltan Herczeg 1b4426fd2a Check whether match result has error flag. (#1653)
Fixes #1641.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-03-14 10:01:22 +01:00
Gabor Loki ed32ba148c Fix the example code of 'jerry_define_own_property' function (#1656)
JerryScript-DCO-1.0-Signed-off-by: Gabor Loki loki@inf.u-szeged.hu
2017-03-13 15:52:06 +01:00
Zoltan Herczeg 679500b327 Improve breakpoint generator of the debugger. (#1652)
Now the debugger generates a breakpoint for each function before
its first executable statement. This allows inspecting the function
arguments. Position (line and column) info is also added which
simplifies finding of anonymus functions. Several tests were
update to check more corner cases.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-03-13 11:36:34 +01:00
László Langó 57ea06782b Fix several pylint warnings. (#1644)
Fixed
 * 'unused-wildcard-import'
 * 'bad-whitespace'
 * 'bad-continuation'
 * 'wrong-import-order'
in 'build.py', 'run-tests.py' and 'check-license.py'.

Related issue: #1600

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-03-13 11:18:49 +01:00
Zoltan Herczeg b140158104 Fix various number parsing issues. (#1648)
For example Number(".") and Number("e5") should be NaN not
zero. Parsing Number("e") caused buffer overflow as well.
Infinity parsing is a bit faster now.

Fixes #1636.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-03-09 15:03:46 +01:00
Tilmann Scheller f8dd54abb6 Fix old-style function definitions and enable warning. (#1651)
Function definitions with no parameters should always use the void keyword to allow the compiler to catch invalid calls of those functions at compile time.

Enable -Wold-style-definition to catch this early in the future.

Fixes #1649.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2017-03-09 13:41:26 +01:00
Yanhui Shen a2a160d6f9 Improve error messages (#1577)
JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2017-03-08 10:58:25 +01:00
Zoltan Herczeg 319702cdd2 Support internal properties in GC mark. (#1646)
Some internal properties are incorrectly handled as objects and
marked as visited. This memory overwrite caused random crashes
in IoT.js.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-03-07 14:14:05 +01:00
Zoltan Herczeg a20b9dfa19 Introducing debugger modes (run, breakpoint). (#1645)
This makes the code more robust and error prone, since certain
messages cannot be received in certain situations, e.g. an eval
command during garbage collection.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-03-07 11:58:46 +01:00
Zidong Jiang c6f22a9683 Make sure the size arg of alloc will not overflow (#1618)
Also make sure the bytelength = arraylength << shift will not overflow

Fix issue #1616

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-03-07 08:37:19 +09:00
Zidong Jiang 71e1383d13 Check if propery is not found before delete it. (#1637)
Fix issue #1633

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-03-06 21:08:30 +08:00
Levente Orban 8a86c579e6 Refactor the debugger multiple command usages (#1643)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-06 20:41:22 +09:00
Zidong Jiang b13f78f19e Check options in ecma_op_object_get_own_property for typedarray. (#1627)
And add regression-case subfolder for es2015

Fix issue #1622

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-03-06 19:07:02 +08:00
Zoltan Herczeg b5a91069fd Fix multiple debugger issues. (#1640)
- Wait for free byte code pointers during garbage collection.
- Detect incorrect free requests in the debugger server.
- Ignore byte code blocks loaded from snapshot.
- Use memmove instead of memcpy to avoid receive buffer corruption.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-03-06 11:13:25 +01:00
Levente Orban b996841a65 Add feature commands for debugger python script (#1604)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-03-06 11:08:30 +01:00
Robert Sipka 6254748081 Require JERRY_JS_PARSER macro to be defined (#1639)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-03-06 09:53:09 +01:00
Zoltan Herczeg ca2b057356 Call property should handle ECMA_SIMPLE_VALUE_REGISTER_REF. (#1631)
Fixes #1624.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-03-03 12:23:18 +01:00
Zsolt Borbély f780f2b8dc Allow to skip certain JS-tests under tests/jerry/ and tests/jerry-test-suite/ (#1632)
Add `--skip-list` option to tools/run-tests.py.

Additional modifications:
 - The test `parser-oom.js` doesn't work when system-allocator is enabled,
   hence we skip it in these jobs.
 - The sanitizer-tasks become mandatory.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-03-02 15:58:23 +01:00
László Langó 92f74f3cf5 Fix pylint install on Travis CI (#1608)
Followup fix after #1602

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-03-02 10:36:21 +01:00
Renáta Hodován 918a50c66b Fix typos in parser error messages. (#1629)
JerryScript-DCO-1.0-Signed-off-by: Renata Hodovan reni@inf.u-szeged.hu
2017-03-02 08:47:54 +01:00
Levente Orban e993ee6cdc Add delete all breakpoints feature to debugger (javascript) (#1628)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-02-28 10:51:48 +01:00
Zoltan Herczeg b8ccdee4db Numbers found in the literal table also has LEXER_LITERAL_OBJECT_ANY type. (#1626)
Fixes #1615.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-28 10:41:41 +01:00
Zoltan Herczeg 6efe39c83c Add source code support to the debugger. (#1614)
Besides the breakpoint list the JavaScript source code is
also sent to the debugger. This feature allows debugging
eval() function calls.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-28 09:25:26 +01:00
Zsolt Borbély c6a7765690 Merge OSX-jobs on Travis (#1625)
The start of OSX-jobs takes a considerable time.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-02-27 16:29:57 +01:00
Zoltan Herczeg 3de72af712 NaN must not be passed to date getter functions. (#1620)
Fixes #1547

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-27 11:19:29 +01:00
Zidong Jiang df4064c18e Implement ecma_object_get_class_name for all ES2015 builtin object (#1617)
Fix issue #1613

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-02-27 09:12:31 +01:00
Zidong Jiang f1d43784f5 No other objects should be allocated before a typedarray is fully (#1619)
initialized.

All members of an object must be valid when the garbage collector runs,
so no allocations are allowed during typed array initialization.

Fix issue #1605
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-02-25 09:23:44 +08:00
Robert Sipka 21340e6b02 Rework address setup in WebSocket Debugger Client (#1612)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-24 13:45:33 +01:00
Zoltan Herczeg 62a581fbb8 Fix typo in vm_decode_branch_offset. (#1611)
Fixes #1597.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-22 14:38:52 +01:00
Zoltan Herczeg 8245cdef2f Stack data should be freed after the for statement is fully parsed. (#1609)
Fixes #1598.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-22 14:38:32 +01:00
Robert Sipka 2d93a24a14 Bugfix for JerryScript HTML (WebSocket) Debugger Client connection (#1610)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-22 12:36:44 +01:00
Robert Sipka 993f1ce896 Set available features from nuttx menuconfig (nuttx-stm32f4 target). (#1607)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-22 12:36:31 +01:00
Robert Sipka 39dc4a6273 Remove shadowed declarations, undefined identifiers, and specify argument types where it is required. (#1601)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-22 10:34:44 +01:00
László Langó 5ef305dfee Avoid using global statement (#1606)
Related issue: #1600

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-02-22 09:12:57 +01:00
Zoltan Herczeg 54544163a9 Completely remove internal property support. (#1603)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-22 10:39:48 +09:00
Levente Orban cc0f69613a Add debugger connection port setting to build script (#1599)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-02-21 15:39:22 +01:00
Robert Sipka 9043ec620d Add debugger support on nuttx-smt32f4 target (#1591)
Using jerry_parse_named_resource to parse script and construct an EcmaScript function.
The file name will also passed to this function which is used by the debugger to find
the source code.
Run the constructed EcmaScript function instead of using the simple jerry runner.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-21 15:22:48 +01:00
László Langó 92eaea2a8e Add pylint checker to the project (#1602)
* Added 'pylint' to dependencies
 * Added pylint config file
 * Added to travis CI as an allow failure job
   (until all of the warnings are fixed)
 * Added to 'run-test.py'

Related issue: #1600

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-02-21 12:40:33 +01:00
Zoltan Herczeg 00e3de230f Introduce debugger status flags to control the operation of the debugger. (#1596)
Two issues were fixed as well: inserting breakpoints before non-directive
prologue strings and the receive can process multiple messages.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-21 11:57:04 +01:00
Levente Orban 33138c09f5 Rework address setup (#1589)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-02-20 09:12:49 +01:00
Zoltan Herczeg b02ef67cd2 Add eval support for JerryScript debugger (#1588)
The server can accept a string, execute it with eval,
and returns with the result converted to string. In
case of exception it returns with the exception message.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-17 14:31:56 +01:00
Gabor Loki 6739463c1e Fix the missing inline specifier if compiling with -fPIC (#1590)
JerryScript-DCO-1.0-Signed-off-by: Gabor Loki loki@inf.u-szeged.hu
2017-02-17 12:41:01 +01:00
Zidong Jiang 4727202c8e Add typedarray routine:reverse (#1585)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-02-16 18:32:13 +01:00
Robert Sipka 188dc46fe0 Rewrite the generator script of unicode ranges. (#1583)
The script generates the source file instead of copy the tables and paste these manually.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-16 18:31:30 +01:00
László Langó 799726aa42 Add new input validator API functions (#1576)
Fixes #1549

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-02-16 18:31:04 +01:00
Zsolt Borbély 93eb35081f Add Debugger documentation to webpage-generator script (#1587)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-02-16 17:39:19 +01:00
Robert Sipka 68afd14f7c Add --start_debug_server cmdline argument to nuttx-stm32f4 target (#1586)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-16 14:19:51 +01:00
Robert Sipka fdd31f20b5 Add print_help function to nuttx-stm32f4 target (#1584)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-16 12:49:49 +01:00
Péter Gál 75d8226af3 Add jerryscript.h and mark jerry-api.h as deprecated (#1579)
Add a notification for JerryScript API users that the jerry-api.h
will be removed in the future and should use the jerryscript.h
header instead.

Also update the examples in the docs and the targets where
the jerry-api.h is used.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2017-02-16 08:46:08 +01:00
Zidong Jiang 64a340ffeb typedarray routine: filter (#1581)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-02-15 19:20:15 +01:00
Zsolt Borbély e09cdffc66 Add address- and undefined behavior sanitizer to Travis CI (#1580)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-02-15 19:19:42 +01:00
Robert Sipka 1b5f839db9 Improve toLowerCase and toUpperCase functions. (#1575)
Language-sensitive mappings are not processed now.

Fixes #323

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-02-15 15:57:55 +01:00
Levente Orban 025a99ccbb Initial version of JerryScript debugger (#1557)
The debugger supports setting breakpoints, execution control (step, next, continue)
and getting backtrace. The communication is WebSocket-based, so a browser can
communicate with JerryScript without any intermediate application.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2017-02-14 15:03:01 +01:00
Zoltan Herczeg 453066fcf1 Regexp exec should not use the empty magic string. (#1582)
This is a workaround for an ASAN issue and a small optimization as well.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-14 14:18:46 +01:00
Zoltan Herczeg 66683e5d4b The main-unix utility should free the return value to avoid leaks. (#1578)
Fixes #1545.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-14 10:09:51 +01:00
slaff 5101d932f7 Fix compilation errors when LCACHE is disabled. (#1570)
JerryScript-DCO-1.0-Signed-off-by: Slavey Karadzhov slaff@attachix.com
2017-02-13 13:14:50 +01:00
Zidong Jiang 24e6c3f062 Add typedarray routine: reduce and reduceRight (#1569)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-02-10 13:36:00 +01:00
László Langó 32674ff379 Documentation update (#1573)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-02-10 11:05:26 +01:00
Zoltan Herczeg bfc5bee394 Restore deleted lines. (#1574)
In a previous patch the original null count behaviour of the
property hashmap is just only partially restored. Now it is
restored fully Also another assertion was forgot to be fixed
in another patch, and we do so now.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-10 10:53:43 +01:00
Zoltan Herczeg be720b2238 Seperate NULL and unused values. (#1572)
Fixes #1552.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-10 08:10:20 +01:00
László Langó 638b753135 Fix CMakeLists.txt in jerry-main. (#1571)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-02-09 15:41:14 +01:00
Zidong Jiang 7b01b29ec8 Add typedarray routine: every, some, foreach, and map (#1566)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-02-09 08:49:00 +01:00
László Langó a976b0c061 Improve performance of GC sweep (#1568)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-02-08 14:58:54 +01:00
László Langó 348894e41f Enable 32bit compressed pointers on 64bit systems. (#1567)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-02-08 14:58:37 +01:00
Zsolt Borbély 510708ebd6 Function jmem_heap_get_region_end is unused when the system-allocator is enabled (#1565)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-02-07 11:43:31 +01:00
Zoltan Herczeg cba165f8e6 Fix invalid assertion in js-parser. (#1556) (#1563)
256 registers can be used so less equal must be used instead of less.

Fixes #1556.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-06 15:50:43 +01:00
Zoltan Herczeg caf9308288 Fix invalid assertion in vm_loop. (#1561)
Because of the fallthrough case the value of 3 is also allowed in the default case.

Fixes #1555.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-06 10:19:31 +01:00
Zoltan Herczeg 589f2dec92 String.match should return on error. (#1560)
Fixes #1546.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-03 15:16:49 +01:00
Zoltan Herczeg a43186db41 Stack data should be freed for do-while statements after the expression is parsed. (#1558)
Fixes #1550.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-03 11:43:36 +01:00
Paul Sokolovsky c9f3869a41 targets: zephyr: Follow Zephyr 1.7-pre on console refactors. (#1548)
JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2017-02-01 13:37:30 +01:00
Zsolt Borbély 77ab2c713e Append external libraries separately not as a string (#1553)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-02-01 08:47:58 +01:00
Zoltan Herczeg 32f130916f Test various spaces in JavaScript source code. (#1554)
Fixes #1551.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-02-01 08:47:26 +01:00
László Langó 107c058bb1 Add doxygen checker (#1540)
* Fixed Doxygen issues
 * Updated Doxygen config
 * Added new script to test whether doxygen generation was successful or not
 * Added to Travis CI

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-01-31 12:27:59 +01:00
László Langó 623975d19f Add testing of 'JERRY_CPOINTER_32BIT' option to Travis CI. (#1544)
Added a new 'buildoptions' option to tools/run-tests.py to add
a comma separated list of extra build options to each test.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-01-30 15:44:26 +01:00
László Langó 7b59c80e18 Use default system allocator on 32bit systems, if JERRY_SYSTEM_ALLOCATOR is defined. (#1541)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-01-30 11:04:25 +01:00
Zoltan Herczeg 0c3ef892c0 Rework property hashmap delete. (#1543)
Triggering hashmap recreate during property delete may damage the
property chain list, so recreate postponed after the delete is done.

Next attempt to fix #1533.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-01-27 15:31:27 +01:00
Zidong Jiang 0547b31c16 [ES2015][TypedArray] add other 8 types (#1532)
Add Uint8Array, Int16Array Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array and Uint8ClampedArray. Support the conversion between any pairs of those types.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-01-24 15:06:31 +01:00
Robert Sipka 124582793f Copy the characters of an UTF-8 encoded substring into a specified buffer (#1524)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-01-24 15:04:48 +01:00
László Langó 976c8aee80 Organize public and internal parts of memory management (#1539)
* Introduced new 'jmem.h' for public part.
 * Removed obsolete headers

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-01-24 12:36:53 +01:00
t-harvey f88d1a4863 These changes are designed to enable the TI compilers to compile (#1505)
Jerryscript.  The changes include:

CMakeLists.txt: we added conditionals around GCC-specific flags, added
support for TI flags, and removed the always-on debugging flag (-g)

/toolchain_mcu_tim4f.cmake: new toolchain file uses TI-specific parameters

jerry-api.h: the sys/types.h file was #include'd but never used, so we
removed it

jrt-types.h: ditto

jerry-port-default-date.c: the TI toolchain doesn't include
sys/time.h, so we guarded uses of the package

ecma-objects-general.c: added initialization that Travis (the
auto-checking tool) required

JerryScript-DCO-1.0-Signed-off-by: Timothy Harvey t-harvey@ti.com
2017-01-24 07:38:53 +01:00
t-harvey 94b6aae52c Added #if control around GCC built-in functions so that the code can be (#1483)
compiled using non-GCC compilers.

This included adding an initialization to a variable that looks(!)
like it can reach a use before being initialized (b/c we turned
JERRY_UNREACHABLE into a nop) -- an example:

int foo;
switch (value_can_only_be_one_or_two)
   case 1:
   case 2:
       foo = 5;
   default:
      JERRY_UNREACHABLE();
x = foo +1;

...the compiler assumes that the path can go through the default case,
which leaves the value of foo undefined.

JerryScript-DCO-1.0-Signed-off-by: Timothy Harvey t-harvey@ti.com
2017-01-23 12:19:35 +01:00
Zsolt Borbély 5d7972d053 Add missing argument of jerry_parse_and_save_snapshot in API reference (#1537)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-01-23 11:13:59 +01:00
Zoltan Herczeg 8b5d645df6 Track all NULL values in the property hashmap. (#1534)
There are two types of NULL values in the property hashmap: deleted
entries, and never used entries. The current implementation tracks
only the never used entries, and never scales back the hashmap.
After this patch property delete can also recreate the hashmap, or
remove it entirely if there are too few items in the array.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-01-19 11:34:24 +01:00
László Langó 6c708102d3 Minor fix in API reference (#1536)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-01-19 11:31:30 +01:00
Jan Jongboom ec14622cb1 target: mbedos5: Change to debug profiles (#1531)
In mbed OS 5.3 (which we target with JerryScript on mbed) we change the way debug builds are created. This patch changes the Makefile in JerryScript to reflect this.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2017-01-17 14:55:23 +01:00
László Langó 471ad284f6 Remove 'OBJECT_ID' from builtin headers. (#1529)
After 378d7f7 it is not used in the codebase and can be eliminated.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2017-01-17 08:58:46 +01:00
Zoltan Herczeg 4b5cf8ad26 HasInstance should accept the prototype of all functions. Fixes #1519. (#1520)
The regression-test-issue-736.js is also changed, since it expects
throwing an error, which does not happen anymore because the "x"
variable is undefined.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-01-16 13:43:54 +01:00
Geoff Gustafson 6e5b759319 Improve some wording in reference counting documentation (#1523)
JerryScript-DCO-1.0-Signed-off-by: Geoff Gustafson geoff@linux.intel.com
2017-01-16 09:59:30 +01:00
Paul Sokolovsky bd488e6efb targets: zephyr: Remove unused misc/shell.h header. (#1528)
It's also gone in Zephyr 1.7.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2017-01-16 09:25:39 +01:00
Paul Sokolovsky f1a80805c2 target: zephyr: Switch to MinSizeRel build type following mainline. (#1527)
Fixes #1526.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2017-01-16 09:24:31 +01:00
Zidong Jiang 4f3dc2f37c Update macro definitions in Curie-BSP target (#1525)
* add JERRY_JS_PARSER
* add CONFIG_DISABLE_ARRAYBUFFER_BUILTIN
* add CONFIG_DISABLE_TYPEDARRAY_BUILTIN
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-01-16 09:22:15 +01:00
Robert Sipka 7139f0172a Copy the characters of a cesu-8 encoded substring into a specified buffer (#1516)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-01-13 13:27:07 +01:00
Zidong Jiang adfe61b4ed [ES2015 profile]add TypedArray intrinsic object (#1507)
* add %TypedArray% intrinsic object
* implement Int8Array
* will implement other types and prototype functions
in the following patches.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2017-01-13 11:04:34 +01:00
Jan Jongboom 177c30de78 target: mbedos5: Support for building on Windows (#1522)
This patch allows users to build for the mbedos5 target on Windows (normal
Windows and Cygwin). Also needs
https://github.com/ARMmbed/mbed-js-gulp/pull/14.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2017-01-13 09:57:38 +01:00
Robert Sipka c9afc2259d Refactor the ecma_string_substr function (#1517)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-01-13 09:22:55 +01:00
Zsolt Borbély f1ed5715e3 [API] Introduce jerry_parse_and_save_literals() (#1500)
This function can be used to save literals into a specific file in a list or C format.
These literals are valid identifiers, and doesn't match to any magic-string.
The '--save-literals-list-format FILE' and '--save-literals-c-format FILE'
options are used to save into the given file, when the snapshot-save is enabled.
The saved literals are sorted by size and lexicographically.
The C-format is useful for jerry_register_magic_strings() to generate the array
of external magic strings.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-01-11 14:18:09 +01:00
Zoltan Herczeg 7d83293762 Improve date helpers. (#1499)
Rework date to string conversion, and remove nan checks from inline
functions. Furtermore some inline functions are changed to normal
functions.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2017-01-11 08:27:29 +01:00
Jan Jongboom 00b220bde6 target: mbedos5: Sort magic strings (#1518)
Magic strings are expected to be sorted by length, then alphabetically after https://github.com/jerryscript-project/jerryscript/pull/1506 landed. This breaks the mbedos5 target against JerryScript master as it emits the pins in the order that it finds the pins. This patch sorts the pin names.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2017-01-11 08:26:40 +01:00
Zsolt Borbély eef6e57a4c Skip out license-check in case of test262 tests (#1504)
Can break testruns, when the test262 folder already present.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-01-09 09:44:40 +01:00
Zsolt Borbély 1c38c12531 [API] Improve the performance of the external magic id search (#1506)
After this patch, we have to provide external strings ordered by size and lexicographically.
We can do this with jerry_parse_and_save_literals() (#1500).

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-01-09 09:42:43 +01:00
Robert Sipka ff8ff982de Change the default build type to MinSizeRel. (#1513)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-01-09 09:14:21 +01:00
Robert Sipka 445ca1d6de Add jerry_string_to_utf8_char_buffer API function. (#1501)
Copy the characters of a string into a specified utf-8 string buffer.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-01-05 09:35:31 +01:00
Jan Jongboom 8ebbfda996 target: mbedos5: mbed CLI refuses to build if no .mbed file present (#1512)
With the newest release of mbed CLI (1.0.0) it error's when no .mbed file is present in the project root. This breaks builds for JerryScript on mbed OS 5. With this patch we create this file and builds succeed again. We cannot use `mbed new` because it also creates a new git repository in targets/mbedos5 folder which is not what we want.

Fixes #1511

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2017-01-05 08:42:19 +01:00
Akos Kiss 0026519040 Fix documentation errors (#1510)
Doxygen reported a few issues, which are fixed by this patch:
* ArrayBuffer-related documentation group names and titles were
  incorrect.
* Some Date-related helper functions used incorrect parameter
  documentation syntax.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-01-03 18:03:47 +01:00
Akos Kiss 3fa89baee0 Reduce scope of variable in JS lexer (#1509)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2017-01-03 17:59:52 +01:00
Zsolt Borbély 212f35c1f0 Fix test-api.c (#1503)
* Add missing feature-requirement for snapshot test
 * Fix wrong multiline alignments

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2017-01-03 05:39:55 +01:00
Kristof Kosztyo a3e9838728 Fix urls in the example (#1508)
The urls in the docs/03.API-EXAMPLE.md was pointing to
the old samsung.github.io pages.

JerryScript-DCO-1.0-Signed-off-by: Kristof Kosztyo kkristof@inf.u-szeged.hu
2017-01-02 11:32:58 +01:00
Robert Sipka 392f6d4a3b Modify the profile option to specify external compile definitions. (#1497)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-01-02 10:47:50 +01:00
Robert Sipka 080e78d7c2 Set memory heap size in the build script. (#1502)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2017-01-02 10:19:31 +01:00
Zoltan Herczeg 0c7d99e8e7 Reduce Math object binary size. (#1491)
Although many Math built-in functions have a similar structure
these code paths were implemented as separate C functions.
After this patch only one common dispatcher remains which shares
the common code paths of different built-in functions. This
reduces the binary size by 1 Kbyte.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-12-19 13:48:17 +01:00
Robert Sipka f2b17bca8b Warning fixes for Clang build. (#1490)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-19 09:47:42 +01:00
Tilmann Scheller 65c32f6a3b Add parameter names to function declarations. (#1498)
It's generally considered a bad programming practice to have function declarations without parameter names.

This is another legacy from the early days of the project. Fix in one go to minimize history disruption.

Used a custom clang-tidy check to create the bulk of the change.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-12-16 15:40:46 +01:00
Tilmann Scheller 1e99be90c3 Remove redundant extern keywords from function declarations/definitions. (#1495)
Extern keywords on function declarations/definitions provide no additional value since function declarations/definitions default to external linkage in C99, e.g. removing them won't change the semantics of the program.

The extern keywords were essentially a legacy from the early days of the project. This commit cleans this up across the whole codebase in one go to minimize history disruption.

The bulk of the changes in this commit were produced by a custom clang-tidy checker.

Note that variables declarations carrying the extern keyword are untouched by this commit since there the presence of the keyword actually has an impact on the semantics of the program.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-12-16 10:18:37 +01:00
Jan Jongboom defd97cc51 target: mbedos5: Update generate_pins.py to use the new Python API for querying targets, and use the new location of target PinNames.h file. Previously make source/pins.cpp just failed silently, and returned an empty file. Therefore using pin names from JS (LED1) would silently fail when building JerryScript against mbed OS 5.2.3. We missed this because it does not happen when you upgrade an existing mbed OS 5.1 project. Fixes #1493. (#1494)
JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2016-12-16 10:12:49 +01:00
Robert Sipka eec398181e Set PORT_DIR in the build script. (#1492)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-15 10:30:18 +01:00
Robert Sipka f3436840dd Build fix for STM32F4-Discovery board with NuttX. (#1489)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-13 15:12:55 +01:00
Zoltan Herczeg 7423226acc Reduce Date prototype binary size. (#1488)
Before this patch each built-in routine had a separate C
function. Although these functions shared a lot of common
operations compilers cannot eliminate these code duplications
in the final binary code. This patch introduces a single C
function which handles all date prototype routines. Each
shared code block has only one binary represenation.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-12-13 13:41:36 +01:00
Tilmann Scheller 58bcf12665 Add section about license headers and copyright notices to the Contribution Guidelines. (#1486)
Clarify that each contributed file needs to have a proper license header and that the addition of individual copyright notices is not permitted.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-12-13 11:17:47 +01:00
Robert Sipka ee93cb6320 Add JERRY_FEATURE_JS_PARSER to compile time enabled feature types. (#1487)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-13 10:05:59 +01:00
Zoltan Herczeg 6904b9bd65 Do not copy source string by JSON parser. (#1481)
The JSON parser required a zero terminated writable copy of
the original string. The requirement is eliminated from the
project to reduce peak memory consumption.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-12-13 08:36:01 +01:00
Jan Jongboom fb2818c137 target: mbedos5: Update to mbed OS 5.2.3 (#1468)
Update mbed OS target to latest version of mbed OS (5.2.3). Also rename all files in jerryscript-mbed-drivers/ to include -js.cpp, as our build tools now generate warnings for C++ files with the same name. mbed-events library is now mainlined, so no longer required to pull this library in as a separate dependency.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2016-12-13 08:34:38 +01:00
Jan Jongboom c079b577c8 target: mbedos5: Define JERRY_JS_PARSER macro, which is now required to be defined. Fixes build issues against mbedos5 target. (#1485)
JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2016-12-13 08:33:28 +01:00
Zidong Jiang 85b6e01bc2 Stop inlining the ArrayBuffer helper functions. (#1484)
Related issue #1468.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-12-12 20:07:51 +01:00
Robert Sipka e9ab1f14d3 Set js-parser feature in the build script. (#1482)
Renamed FEATURE_PARSER_DISABLE to FEATURE_JS_PARSER.
Fixed the build error that occurred in case of disabled js-parser.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-12 13:43:53 +01:00
Jan Jongboom 233b885ad8 target: mbedos5: Allow jerry_port_console and jerry_port_log to be overriden by user code (#1458)
We're building a REPL (as user-space program) on top of mbedos5 target. For this I need to override the jerry_port_console and jerry_port_log functions from the REPL. This commit wraps these functions in an ifndef, so we can define macros to not include these files.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2016-12-12 08:30:49 +01:00
Sergio Abraham Martinez Rodriguez db05d85a9a Add feature to remove parser. (#1476)
Remove the parser so we can save space if we are
only interested in running snapshots.

Removing the parser enables the snapshot execution.

JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
2016-12-09 15:38:40 +01:00
Zidong Jiang 551aaa58e6 Fix unchecked size number conversion in ArrayBuffer (#1479)
Free_value after ecma_op_to_number and a related test file.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-12-09 14:54:34 +01:00
Robert Sipka 3ec395ff76 Create a minimal commandline tool to run benchmarks with it. (#1478)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-09 13:30:33 +01:00
Zoltan Herczeg 9d6ca800e1 Remove INSTANTIATED_MASK_32_63 internal property type. (#1474)
Furthermore the maximum number of properties is increased to 96.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-12-09 13:28:06 +01:00
Robert Sipka 4f8b7726d7 Check the compile time enabled feature via API function instead of check the MACRO is defined. (#1471)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-09 12:39:37 +01:00
Robert Sipka 9802130c71 Fix the order in cmake build settings/options and their status messages. (#1480)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-09 11:50:59 +01:00
Zidong Jiang fb2edd8556 Add ArrayBuffer regression tests (#1477)
Add a set of tests to ensure basic coverage of the ArrayBuffer built-in. Support for ArrayBuffer was added in #1467.

Closes #1475.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-12-09 08:04:49 +01:00
Tilmann Scheller 0511091e8a Streamline copyright notices across the codebase. (#1473)
Since the project is now hosted at the JS Foundation we can move to unified copyright notices for the project.

Starting with this commit all future contributions to the project should only carry the following copyright notice (except for third-party code which requires copyright information to be preserved):

"Copyright JS Foundation and other contributors, http://js.foundation" (without the quotes)

This avoids cluttering the codebase with contributor-specific copyright notices which have a higher maintenance overhead and tend to get outdated quickly. Also dropping the year from the copyright notices helps to avoid yearly code changes just to update the copyright notices.

Note that each contributor still retains full copyright ownership of his/her contributions and the respective authorship is tracked very accurately via Git.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-12-08 06:39:11 +01:00
Zidong Jiang 29d058cec4 Add ES2015 feature: ArrayBuffer (#1467)
This patch implements ArrayBuffer and ArrayBuffer.prototype built-in objects.

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-12-07 14:04:01 +01:00
Robert Sipka eccfc1849e Bugfix: The unittest which test the API has failed in case of disabled error-messages (#1470)
and disabled snapshot_exec options.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-05 10:33:53 +01:00
LeeHayun bed094f74f Fixes the bug of ecma_date_make_day() (#1836) & ecma_date_week_day(). (#1466)
The ecma_date_make_day() handled any date in October on leap years incorrectly,
which was mentioned in issue #1836. The ecma_date_week_day() returned minus values
when return week_day before 1970 years which was also incorrect.

This change solves these bugs. In addition, this enhances the algorithm of accessing 'the ym-mn-1'
by replacing binary search to simple computation at ecma_date_make_day().

JerryScript-DCO-1.0-Signed-off-by: Hayun Lee lhy920806@gmail.com
2016-12-05 09:58:36 +01:00
Robert Sipka 4ef3c0caa8 Add API function to check if the specified feature is enabled. (#1465)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-05 09:26:02 +01:00
Robert Sipka 4c1fc7d789 Remove the restriction that the external magic strings must be ascii strings. (#1469)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-03 10:20:46 +01:00
Robert Sipka 23cf7fd177 Add an API function to calculate the UTF-8 encoded string length from Jerry string. (#1460)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-12-01 10:51:23 +01:00
Paul Sokolovsky 958344ee16 target: zephyr: Update to Zephyr 1.6 API. (#1462)
Zephyr 1.6 switched to "unified kernel API". Old API is supported, but
deprecated and leads to warnings.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2016-12-01 08:24:40 +01:00
Zsolt Borbély 7b2fc4f27a Remove leftover from main-unix.c (#1464)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-11-30 15:01:19 +01:00
Robert Sipka fb3e8cf8b8 Replace // double slash comments with /* */. (#1461)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-11-29 15:54:35 +01:00
Jan Jongboom 4d2c22a118 target: mbedos5: Add PwmOut and AnalogIn interfaces (#1455)
mbed OS 5 target is currently missing wrappers around PwmOut and AnalogIn interface, which are part of the standard library of mbed OS. This commit adds them. Tested with mbed CI test shield. I've followed the coding style in jerryscript-mbed, rather than JerryScript coding style.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2016-11-29 15:46:51 +01:00
Jan Jongboom 9c803672ff target: mbedos5: Add return value to setTimeout/setInterval and implement clearTimeout/clearInterval (#1457)
In the mbedos5 target the setTimeout and setInterval functions are not on spec, as they return 'undefined' instead of an event ID. Also clearTimeout and clearInterval are not implemented, so scheduled events cannot be canceled. This patch changes the behavior of the set* functions, and implements clear* functions.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2016-11-29 15:43:03 +01:00
Robert Sipka 0467239d03 Add an API function to calculate the UTF-8 encoded string size from Jerry string. (#1450)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-11-29 12:25:18 +01:00
Jan Jongboom 6a2f54456f target: mbedos5: Add carriage return in jerry_port_console (#1427)
Serial monitors (like screen on macOS / Linux) expect both CR and LF characters for new lines. Due to jerryscript only printing a line feed after calls to `print()` this makes log messages look wrong. This patch adds a CR when it encounters a LF character in jerry_port_console or jerry_port_log for the mbedos5 target.

JerryScript-DCO-1.0-Signed-off-by: Jan Jongboom janjongboom@gmail.com
2016-11-28 13:11:31 +01:00
Zsolt Borbély 415ff37a8f Introduce jerry-snapshot.c for snapshot-related code (#1452)
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-11-28 13:11:06 +01:00
Zoltan Herczeg 25f58894ef Improve the performance of resolve reference. (#1453)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-11-28 13:10:49 +01:00
Zoltan Herczeg 6d67b8dff9 Reduce memory consumption of property names.
Property names were always required a string reference which consumed
a large amount of memory for arrays. This patch reduces this consumption
by directly storing the value part of certain strings.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-11-25 05:47:01 -08:00
Robert Sipka abaf4c8af8 Fix the calculation of the converted string length in ecma_new_ecma_string_from_utf8_converted_to_cesu8 function.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-11-25 14:15:55 +01:00
Tilmann Scheller 813a7020af Update various repository references across the project to be in sync with the new repository location. (#1448)
JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-11-25 10:34:22 +01:00
Tilmann Scheller 0d07b21d4b Update Travis CI status reference after repository move. (#1447)
Update URL to match the new repository location so the Travis CI badge will start working again.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-11-25 10:29:09 +01:00
Tilmann Scheller 83c39218f1 Update copyright notice in LICENSE and README. (#1446)
Update the LICENSE and README file to reflect that the project IP transfer from Samsung to the JS Foundation has been completed.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-11-25 09:39:16 +01:00
Robert Sipka b2e12233d0 Improve performance of search in the list of the magic strings. (#1441)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-11-24 09:16:16 +01:00
Robert Sipka 97303eb8e4 Add API documentation for jerry_create_string_from_utf8 and jerry_create_string_sz_from_utf8 functions. (#1444)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-11-24 08:12:09 +09:00
László Langó cf7b7a1090 Test 'test262' test suite on Travis CI (#1440)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-11-22 14:02:25 +01:00
László Langó 2622e938d8 Add missing error messages to 'ecma/builtin-objects' (#1443)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-11-22 14:01:59 +01:00
Zoltan Herczeg 132477f7d5 Change array length into a virtual property. (#1439)
This change allows easier access to array length which improves
the performance of inserting new items into an array and there
is no need to allocate length strings anymore. The trade-of is
that array length cannot be cached anymore.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-11-22 13:29:53 +01:00
László Langó 4a0f78bc4b Fix fopen call on non-existing files. (#1442)
The main implementation of unix platform hangs, if the engine was
built with jerry-libc. Open system call returns with a negative
error code if cannot open the file, but fopen must return NULL
when error happens.

Fixes #1437.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-11-21 11:28:07 +01:00
Kumar Gala 6ac0a39519 target: zephyr: Allow parallel build of Zephyr (#1436)
If we are building JerryScript from some other makefile that passes
down a -j option to make we should respect that when we build Zephyr.

JerryScript-DCO-1.0-Signed-off-by: Kumar Gala kumar.gala@linaro.org
2016-11-18 08:19:21 +01:00
Zoltan Herczeg 7131243dda Simplify ecma_property_types_t. (#1438)
Free a new bit in the property descriptor by combining internal
and special property types into one group. Also simplify checking
special properties since bit-and operation is not needed anymore.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-11-17 13:26:02 +01:00
László Langó b2fec888d4 Fix handling of return value of 'jerry_set_property call' in main-unix. (#1435)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-11-17 10:49:45 +01:00
László Langó 503ca7e54a Remove unused test file. (#1433)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-11-17 10:49:34 +01:00
Robert Sipka ffaca583f3 Add API functions to create string from a valid UTF-8 string. (#1430)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-11-16 10:34:12 +01:00
Istvan Kadar 405092e700 Prop hashmap allocation strategy based on gc pattern is implemented. (#1429)
The algorithm is the following:
* introduced a counter variable, which value can be [0-4]
* if its value is 0, property hashmap allocation is enabled
* JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW -> decrease the counter
* JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH -> increase the number
* if JMEM_FREE_UNUSED_MEMORY_SEVERITY_HIGH happens twice in a row increase the counter to 4

According to the measurements this algorithm provides better runtime results in low memory conditions.

JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
2016-11-16 08:32:45 +01:00
Robert Sipka e443d95566 Add case insensitive argparse choices. (#1431)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-11-15 09:57:08 +01:00
Robert Sipka bf6cccf61c Extend the escape sequences test by verifying character codes. (#1428)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-11-14 13:22:38 +01:00
Robert Sipka dc5ae4638f Since glibc 2.20, the _BSD_SOURCE macro is deprecated. (#1425)
It now has the same effect as defining _DEFAULT_SOURCE, but generates a
compile-time warning (unless _DEFAULT_SOURCE is also defined). To allow
code that requires _BSD_SOURCE in glibc 2.19 and earlier and _DEFAULT_SOURCE
in glibc 2.20 and later to compile without warnings, define both _BSD_SOURCE and _DEFAULT_SOURCE.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-11-11 12:09:51 +01:00
Zoltan Herczeg 9f556e1c38 All strings whose are valid array indicies always use the UINT32_IN_DESC format. (#1422)
This patch reduces memory consumption for strings such as "0" or "123"
by 8 bytes and "4294967295" by 16 bytes. The hash computation is changed
for using the lower 16 bits for these strings which is much faster than
converting the value to string first and compute the hash. The trade-of
is a small overhead when strings are created or concatenated.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-11-07 15:37:36 +01:00
Zsolt Borbély 4c5ff4ad27 Webpage-related fixes (#1420)
* Fix webpage-generator script
   - Generate 'site.github.url' instead of 'site.baseurl' (#1248)
   - Include 'Reference counting' documentation
 * Remove trailing whitespaces from 05.PORT-API.md

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-11-07 17:18:12 +09:00
Levente Orban 8466b04187 Add how to install the modules (#1416)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
2016-11-03 10:42:10 +01:00
Akos Kiss b31074cc6b Ensure that Math.random() really covers [0,1) interval (#1417)
Legacy implementation made incorrect assumptions on how many bits
of useful information is returned by libc's `rand()`. If `RAND_MAX`
had more than 16 useful bits, it assumed that `rand()` could return
32 useful random bits. However, e.g., jerry-libc's `RAND_MAX` is
`0x7fffffff`, which denotes 31 useful bits only. The consequence
was that `Math.random()` covered only the lower half of the
standard-mandated `[0,1)` interval.

This path fixes the error and always uses the exact value of
`RAND_MAX` to compute the random value, which will thus fully cover
`[0,1)`.

Fixes #1414

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-11-01 15:43:16 +01:00
Daniel Thompson 36edae3257 target: zephyr: Cause pristine to remove entire build directory (#1418)
For a normal zephyr application the pristine target simply runs
"rm -rf outdir". However the JerryScript build overrides the output
directory [O=$(OUTPUT)] so Zephyr's implementation pristine is not able
to to a full aggressive clean up for all boards.

For this reason it is better for the JerryScript build wrapper to have
its own implementation of pristine.

JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
2016-11-01 15:29:20 +01:00
Daniel Thompson e65a69b7c0 target: zephyr: Fix build when USE_CCACHE=1 (#1413)
Currently if USE_CCACHE=1 is set to one than the Zephyr build system
will include ccache in the CC variable. ccache cannot be passed to
cmake using EXTERNAL_CMAKE_C_COMPILER (even if we fix the quoting)
because it fails a PATH reachability test within cmake. For that
reasons we solve the build failure simply by removing ccahce from CC
before we pass it into cmake.

The problem described about is a regression due to commit ac1bf19c90
("build: Adopt outputexports") and the fix contained in this patch
restores the original behaviour (zephyr exploits ccache, jerryscript
library build does not).

JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
2016-10-31 13:59:49 +01:00
Istvan Kadar ff6b3a9b02 Issue #1389 fixed in parser_compute_indicies by resolving local variable hiding. (#1410)
JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
2016-10-28 14:56:13 +02:00
Zoltan Herczeg ec4f4e6fdb Add an overview about reference counting. (#1412)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-10-28 13:25:47 +02:00
Paul Sokolovsky 5e02b7136a zephyr: Revamp jerry-port.c, add more functions. (#1411)
The file was named jerry-entry.c and not even built. Rename for clarity,
and add jerry_port_fatal(), jerry_port_get_current_time(),
jerry_port_get_time_zone() functions. User-visible result is that
if Date builtin is enabled (e.g. if building "full" config, its
Date.now() method can be used to measure relative time difference,
e.g. for benchmarking).

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2016-10-27 14:23:37 +02:00
Robert Sipka a02c586a51 Bugfix for string replace. (#1409)
Some test cases were failed with enabled show-opcodes build option.

Example source:
    "98765".replace(76)
    print ("\ud801\udc00".replace("\ud801", "#") === "#\udc00");

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-10-27 12:47:54 +02:00
László Langó a30b89c536 Improve Js2C converter (#1408)
* Rename 'jerry_targetjs.h' to 'jerry-targetjs.h',
   because we use dashes in filen ames instead of underscores.
 * Made destination and js souce directory configurable.
 * Updated esp8266 target to the recent changes.
 * Updated mbed and mbedos5 target to the recent changes.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-10-27 09:54:01 +02:00
Daniel Thompson ac1bf19c90 build: Adopt outputexports (#1407)
This patch simplifies the integration with the zephyr build system
whilst at the same time enriching the set of build targets to allow
zephyr to be configured using its kbuild features.

It works by exploiting "make outputexports", a feature of the zephyr
build system that makes the zephyr compiler configuration available to
other build systems in an easily accessible manner.

Whilst looking at the build we also correct the implementation of clean
so that it no longer destroys any custom zephyr configuration. Like any
other zephyr application one must use "make pristine" to remove the
config too.

JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
2016-10-26 09:01:34 +02:00
Zoltan Herczeg 945fbef110 Rework function.bind (#1406)
The new code does not use value collections which reduces the argument array size by half.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-10-25 13:15:14 +02:00
László Langó dc1e26933f Print source code with a given context when a parse error happens (#1403)
Example source:
  var s = "hello";
  if (s)
    a[,] = s;

Output:
  var s = "hello";
  if (s)
    a[,] = s;
  ~~~~^
  Script Error: SyntaxError: Primary expression expected. [line: 3, column: 5]

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-10-25 13:13:20 +02:00
Zoltan Herczeg c8f2747209 Rework arguments object. (#1401)
Instead of allocating a helper object, argument names are appended right
after the arguments objects. This reduces memory consumption and improve
performance as well. In the future this could be further improved by a
bitfield, but that would require a reference to the byte code which
might increase memory consumption in a few corner cases.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-10-21 18:58:42 +09:00
László Langó 3e0d3e588f Add error messages to VM. (#1405)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-10-21 18:55:08 +09:00
Paul Sokolovsky fdf9e71caa target: zephyr: Make "OUTPUT" varible match Zephyr's "O" variable. (#1404)
JerryScript Zephyr port overrides standard Zephyr output location. But
components integrating Zephyr port may want to override it again. Make
sure that arbitrary overrides are possible, and just set the default
value to Zephyr port's custom preference.

JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
2016-10-21 11:52:19 +02:00
Robert Sipka b9f540fc90 Change the return type of 'vm_init_loop' function to void. (#1402)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-10-20 21:03:15 +09:00
Robert Sipka 922782109b Fix for Issue #1387. (#1397)
Check the return value of 'ecma_op_put_value_lex_env_base' function.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-10-20 09:13:11 +02:00
László Langó 28b4d3cb58 Remove trash from main-unix (#1400)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-10-20 15:48:56 +09:00
Zoltan Herczeg fd98d649b6 Remove several internal property types for primitive objects. (#1399)
Class and value internal properties are always exists for primitive
types (e.g. Boolean, Regex) so they can be stored right after the
object. This improve property access (since internal properties are
searched by a slow linear algorithm) and reduces memory consumption,
since only 8 byte is allocated for these two properties instead of
16 which is the size of a property pair.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-10-19 15:36:15 +02:00
slaff 2ef89eafbf Added console message implementation for ESP8266. (#1398)
JerryScript-DCO-1.0-Signed-off-by: Slavey Karadzhov slaff@attachix.com
2016-10-19 12:56:09 +02:00
Zoltan Herczeg 3ce48be152 Improve array length setting. (#1393)
The new set does not allocate memory when the size of the array is reduced.
Furthermore the [[PutObject]] method directly calls the new length setter.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-10-19 16:45:17 +09:00
László Langó a130059c8b Add error messages to ecam/operations. (#1396)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-10-19 09:37:51 +09:00
Zoltan Herczeg 6af70e5899 Change string length into a virtual property. (#1395)
Reduces the memory consumption of String objects.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-10-18 11:11:00 +02:00
Robert Sipka e8428383f1 Use 'ecma_make_boolean_value' where possible. (#1394)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-10-18 09:12:05 +02:00
Robert Sipka 42be0704b9 Added target to compile JerryScript beside Particle Device Firmware on Photon board. (#1391)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-10-17 20:54:08 +09:00
Sergio Abraham Martinez Rodriguez 535743412e [zephyr] Removed factory setting deprecated on zephyr (#1390)
The new zephyr build system doesn't support the arduino_101_factory
board.

This change restores the default BOARD to arduino_101 which
is the current recommended method.

If you are in an older SDK / Zephyr you can still use.

`make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory`

JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
2016-10-10 08:40:58 +02:00
Akos Kiss 9915307bc0 Drop -gdwarf-4 from compiler flags (#1385)
`-g` is enough (most modern compilers use DWARF4 as default, at
least, e.g., GCC has switched from DWARF2 in 4.8), more future
proof (if a compiler moves to a newer version, it wont get forced
to a fixed older version), and less restrictive (some compilers
handle the "standard" `-g` only but don't understand its variants).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-10-04 11:51:03 +02:00
Akos Kiss 37c28f694a Undef VALGRIND_*_SPACE macros at the end of sources (#1382)
Defining the same macros in multiple source files can cause macro
re-definition warnings or errors in all-in-one builds.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-30 09:03:25 +02:00
Akos Kiss e16cc83ce7 Simplify the way libgcc is linked (#1380)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-30 09:02:42 +02:00
Daniel Thompson 8320a2cbc9 target: zephyr: Include toolchain headers using -isystem (#1381)
Currently the zephyr port fails to build with some cross-toolsets because
warnings from the system headers are being treated as errors. Using
-isystem for any includes in TOOLCHAIN_CFLAGS allows us to crank up the
warning levels without worrying about newlib headers breaking the build.

JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
2016-09-30 07:45:50 +02:00
Daniel Thompson 7584ce26c2 target: zephyr: Select compile options by ARCH rather than BOARD (#1374)
Currently we need to modify the JerryScript Makefiles for every new
board we want to work with. It is better to study the zephyr configuration
and used the CONFIG_ options to determine the right compiler flags.

We expose the CONFIG_ options to make by adding machinary to the makefiles
to import the Zephyr .config file, allow us to make the decisions we
need.

JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
2016-09-29 23:34:13 +02:00
Akos Kiss 509407bfd4 Update jerry-libc unreachable asserts (#1379)
Newer compilers (especially clang) warn (and fail) on
`assert (!"message");` constructs typically used to assert on
unreachable code paths (multiple occurrences in jerry-libc). A more
up-to-date approach is to use `assert (false && "message");`. This
patch applies the pattern to all relevant asserts in jerry-libc.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-29 16:17:46 +02:00
Akos Kiss e2aa714565 Improve the stdin handling of the command line tool (#1378)
This patch improves the command line tool in two ways:
* The tool can be instructed to read and execute a script from
  stdin by invoking it as `jerry -`.
* The tool can be instructed to suppress its prompt when in repl
  mode by invoking it as `jerry --no-prompt`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-28 14:14:05 +02:00
Akos Kiss 9b5d0cc7ec Add IRC notification to Travis CI configuration (#1376)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-26 16:07:29 +02:00
Akos Kiss e67078f5ca Revoke exec permission from non-scripts (#1377)
Several non-script files have been added with exec permission to
the repository. This patch revokes the erroneous permissions.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-26 08:27:29 +02:00
Zoltan Herczeg 0ad347b97f Improve define own property. (#1369)
This patch changes define own property to search a property only once.
Currently all existing properties are searched at least twice, sometimes
three times which is not optimal.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-23 10:06:36 +02:00
chokobole 547647af13 Type cast according to format string (#1368)
JerryScript-DCO-1.0-Signed-off-by: wonyong.kim wonyong.kim@samsung.com
2016-09-23 09:47:13 +02:00
Akos Kiss 40bed0f963 Fix compiler warnings in unit tests (#1373)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-22 15:48:14 +02:00
Akos Kiss e4f27199d7 Echo executed test commands in run-tests.py (#1372)
run-tests.py used to echo the build commands it executed, but did
not behave the same way when it executed test commands. To make its
behavior more traceable, this patch adds echo for test commands as
well.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-22 08:51:59 +02:00
Akos Kiss ee2e159ad6 Switch cppcheck to C99 mode (#1371)
From the beginning, we have been configuring cppcheck to check its
input as C++ source. However, the transition to C99 happened a
while ago. This patch switches cppcheck into C99 mode.

Some related changes:
* Progress reporting of cppcheck just clutters the output and makes
  warnings hard to discover. Thus, this patch puts cppcheck into a
  quieter mode where it prints anything only if a non-suppressed
  warning is found.
* The default warning format of cppcheck is a bit different from
  usual compiler error/warning format. This patch configures
  cppcheck to use a more familiar warning template.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-21 18:41:44 +02:00
Akos Kiss 70cd3d3184 Add license checking (#1353)
It's stated in the Guidelines that all contributions must be under
the Apache License 2.0. To avoid potential mistakes from manual
reviews, this patch adds the check-license.py script to
automatically check all source files for license headers.

Travis CI is also configured to run the check.

Fallout: it turned out that some files already in the code base
either miss a license header or have some minor typo differences.
The patch fixes up some of these deficiences.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-21 16:15:57 +02:00
Matthew Else 454d3af951 Initial support for mbed OS 5.1 (#1318)
- Wrappers for mbed I/O drivers
- Makefile for automating build process
- Script to generate pin definitions from mbed OS source tree
- Updates to js2c to enable building without a main.js file

JerryScript-DCO-1.0-Signed-off-by: Matthew Else Matthew.Else@arm.com
2016-09-21 15:48:03 +02:00
Akos Kiss 316223ebdb Fix doxygen-related documentation issues (#1357)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-21 10:43:40 +02:00
Akos Kiss 2300a68c88 Unify (and fix) the naming convention of structures (#1358)
The naming convention of the project for `struct`s is
`typedef struct x_t { } x_t`, but only if it has self-recursive
pointer members, otherwise `typedef struct { } x_t` is enough.
This patch applies this style consistently throughout the code
base.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-21 10:41:36 +02:00
Akos Kiss 513d9f4c9c Sync cmake and build.py defaults (#1360)
* Cmake had LTO OFF, build.py had LTO ON by default. ON became the
  common setting.
* Cmake had snapshot save/exec OFF, build.py had them ON by
  default. OFF became the common setting.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-20 16:20:48 +02:00
zherczeg 8b55a4ef7b Rewrite ecma_op_get_value_object_base to use ecma_op_object_find_own() call. (#1365)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-20 13:33:57 +02:00
Yanhui Shen a9d6978e4b Fixing ecma_builtin_number_prototype_helper_round. (#1362)
"ecma_builtin_number_prototype_helper_round" is used by following
functions:
* ecma_builtin_number_prototype_object_to_fixed
* ecma_builtin_number_prototype_object_to_exponential
* ecma_builtin_number_prototype_object_to_precision

The current implementation does not support currying numbers and will
produce illegal digit for some test cases. For example, the result of
"0.95.toFixed(1)" is "0.:".

This patch fixs the issue, however the implementation of "toFixed" is
still problematic, at least not meet section 15.7.4.5 8.a of the
specification. The related test case is:

* assert((0.995).toFixed(2) === "0.99");
* assert((9.995).toFixed(2) === "9.99");

Reference:
* http://www.ecma-international.org/ecma-262/5.1/#sec-15.7.4.5

JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2016-09-20 13:13:50 +02:00
Zidong Jiang 7b7d86f5fd Remove the vm_run_with_inline. (#1363)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-09-20 13:11:53 +02:00
zherczeg 9ab72d24b7 Improve ECMA_PROPERTY_VALUE_PTR computation. (#1364)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-20 12:50:53 +02:00
Akos Kiss 971dcae669 Define __attr_hot___ for __attribute__((hot)) (#1359)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-19 15:33:54 +02:00
Zoltan Herczeg dcaec22c0c Major property rework: introducing virtual properties.
Properties are changed to a type and value pair instead of a pointer to an internal
representation. Functions such as ecma_op_object_get_[own_]property do not
return with property pointers anymore.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-19 00:32:38 -07:00
Tilmann Scheller ea96430e77 Add contribution guidelines and DCO. (#1348)
The current content in CONTRIBUTING.md is largely based on the "Patch Submission Process" Wiki page.

This commit also moves the DCO from the Wiki into the source tree.

In addition, clarify in README.md that contributions need to be licensed under the Apache License 2.0 and signed with the DCO.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-09-16 15:50:56 +02:00
Akos Kiss d38ab71140 Improve the linking of libraries (#1338)
Although both jerry-libc and jerry-libm have configuration options
that enable/disable their build, in practice, only jerry-libc can be
replaced with the system (compiler-default) libc. If jerry-libm is
disabled, the build of jerry-main fails, as there is no way to
instruct the linker to link the system libm to the binary. (The
build system does have a way to pass flags to the linker, but those
flags are listed before the linked objects. For the references to
get resolved correctly, the libraries to be linked have to be
specified _after_ the objects.)

This patch adds the EXTERNAL_LINK_LIBS configuration option to
CMakeLists, which ensures that the specified libraries get
correctly passed to the linker. (E.g, replacing jerry-libm with
system libm becomes possible with
`JERRY_LIBM=OFF EXTERNAL_LINK_LIBS='-lm'`.)

Additionally, the patch also makes the following related changes:

* Removes the COMPILER_DEFAULT_LIBC configuration option, as it is
  (almost) always the opposite of JERRY_LIBC. Moreover, its name is
  misleading: its only role is to add `-nostdlib` to the linker
  flags.

* Makes use of transitive library dependencies: if a library has
  another library as dependency, and it is linked to a binary, its
  dependency is linked as well. Thus, jerry-libc, jerry-libm, and
  any external libraries are added to jerry-core as dependency, and
  then only jerry-core is linked to executables (cmake will take
  care of the rest).

* build.py and run-tests.py follow up the changes, along with some
  minor syntax changes.

* Moves static linking option to global CMakeLists, as unit test
  binaries should be linked the same way as jerry-main.

* Adds EXTERNAL_COMPILER_FLAGS and EXTERNAL_LINKER_FLAGS as last to
  the flag list, to allow user override of (nearly) anything.

The patch speculatively follows up the build system changes in the
mbed, riot-stm32f4, and zephyr targets.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-15 13:07:01 +02:00
Zidong Jiang 86ac6445e8 Fix bug in vm call_stack_size calculation (#1345)
call_stack_size should be register_count + maximum stack depth

* We don't add in the parser to save the size of snapshot header
* jerry_snapshot_version 5 -> 6

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-09-15 09:54:01 +02:00
Akos Kiss 9c50570ca3 Install ARM QEMU and GCC toolchain on Travis CI only if needed (#1350)
(Also some reorganization of the .travis.yml file.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-14 14:44:39 +02:00
Akos Kiss 697037af3f Remove obsolete dependencies from install scripts (#1349)
The new build script does not support ninja anymore, and we haven't
been building bare-metal arm targets for long. This patch removes
now-obsolete dependencies from install scripts.

This can also help to reduce the load on Travis CI (as it keeps
installing dependencies for each build job over and over again).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-14 11:02:44 +02:00
Tilmann Scheller a507c0863c Add a full copy of the Apache License 2.0 text to the project. (#1346)
Previously only a copy of the Apache License 2.0 header (for inclusion into source files) was distributed as part of the sources.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-09-13 16:22:42 +02:00
Yanhui Shen 15c53f7363 Fix getter's this value (#1344)
JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2016-09-13 08:53:26 +02:00
Akos Kiss baeb83db8f Move Travis CI detection logic from run-tests.py to check-signed-off.sh (#1341)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-12 15:11:14 +02:00
Zoltan Herczeg d9979be2f6 Rewrite property get/put to not use ecma_op_object_get_own_property
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-12 03:33:22 -07:00
Robert Sipka 0bc7840c5f Set the number of simultaneous jobs of the build. (#1336)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-12 09:20:24 +02:00
Akos Kiss 2e1c180658 Enable make install (#1335)
With the new build system, the conventional `cmake && make` already
works. However, the last step, i.e., `make install` was still
missing (didn't work). This patch adds the `install()` commands to
CMakeLists that are required to generate the `install` target in
the Makefile.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-09 13:32:36 +02:00
Zoltan Herczeg da02a37a02 Remove several ecma_op_object_get_[own_]property calls.
The ecma_op_object_get_[own_]property calls should be phased out from
the project eventually and virtual properties should be introduced instead.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-09 01:49:57 -07:00
Akos Kiss 7f80b76009 Make build.py's help output less of a "wall of text" (#1331)
`tools/build.py --help` prints a lot of output, which is sometimes
hard to comprehend, especially since some described options are
useful for developers only.

This patch:
* shortens how options are displayed in the output with the help of
  the "metavar" feature of the argparse module ("--option {on, off}"
  becomes "--option X" and the choices are listed in the description
  only); and
* hides all developer-specific options from "--help", and reveals
  them only for "--devhelp".

As a result, help output becomes more readable, especially for
ordinary users, and needs less space.

Some additional changes:
* the options are ordered in a more logical way (although that's
  somewhat subjective);
* help strings start with lowercase letters (it aligns better with
  argparse's overall style); and
* rename "--cpointer_32_bit" to "--cpointer-32bit" (underscores are
  alien to command line options).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-09 10:44:08 +02:00
Akos Kiss 2eb0c5ba1b Print warning at the correct log level in jerry-main (#1334)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-09 09:00:28 +02:00
robertsipka dc83e995d2 Fix for Issue #744
Don't increment the current position in case of a continuation byte.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-08 14:05:14 +02:00
Sergio Abraham Martinez Rodriguez c61e822a45 Specify profile and be able to add extra parameters to configuration (#1333)
Also added jerryscript errors to default compilation

JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
2016-09-08 13:04:35 +02:00
László Langó 5c330d7f8e Improve error messages
* Print location on parser errors.
 * Do not print messages on parse error if FEATURE_ERROR_MESSAGES is not set.
 * Minor style fixes

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-09-08 10:20:13 +02:00
László Langó cf94a25753 Change JERRY_ASSERT to TEST_ASSERT in unittests
JERRY_ASSERT does not check the condition in release builds.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-09-08 08:16:16 +02:00
Akos Kiss 7872f8145a Make jerry-main's link options configurable (#1328)
Until now,
* the link map of jerry-main has always been generated, even though
  it is not used that often;
* static linking has always been forced except for the OSX target.

This patch adds configuration options for these features.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-07 15:54:06 +02:00
Akos Kiss 8d478c142b Add tolerant mode to Signed-off-by check (#1322)
In tolerant mode, only the existence of the Signed-off-by line is
checked but the name and address is not matched against the author
of the commit.

The tools/run-tests.py script is extended to allow calling the
check script in tolerant mode and also to detect whether it is
being run by Travis CI.

The Travis CI config has been modified to check PRs in strict mode
but use tolerant mode for merges to master. This should enable the
use of the Merge button on the GitHub web interface. (The PR is
strictly checked when a contributor opens it but when a committer
merges it via the web interface and GitHub rewrites author details
from the contributor's profile, master will not turn red either.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-07 12:28:29 +02:00
Akos Kiss 714e8d261b Add git commit hash to jerry version info
Previously, jerry-core was built with various build identification
info (build date, git commit hash, git branch name), which was both
available from string constants of the library and also exposed by
jerry-main via the `--version` command line option. As of late,
jerry-core identifies itself only with API version number macros,
but sometimes it could be helpful to get access to the git commit
hash as well, even if that info does not become part of the API.

This patch moves the git commit hash retrieval logic from the build
scripts of jerry-core to jerry-main, and changes `--version` handler
to print the hash as well.

Resolves #1295

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-07 11:14:40 +02:00
Akos Kiss ebbacfc319 Make tools/settings.py lighter (#1327)
It should not import things it does not use and it should define
settings data only (i.e., definition of functions should not happen
there).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-07 08:29:06 +02:00
Robert Sipka caee6f738e Fix -Wsign-conversion Clang warning.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-06 15:56:41 +02:00
Zidong Jiang 27deda5712 remove the alloca.h because of #1294
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-09-06 12:07:31 +08:00
Robert Sipka 2314bc2770 Add the 'jerry-libm/include' path to specified include directories to jerry-core target
in case of enabled jerry-libm build.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-02 09:40:12 +02:00
Zsolt Borbély 6f262aea49 Include Port API documentation to webpage-generator script
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-09-01 16:08:53 +02:00
Akos Kiss 228f6f75f0 Fix warnings reported on OS X (#1307)
OS X build regularly reports some 39 warnings falling in 3 major
categories:

* "static function '...' is used in an inline function with
  external linkage [-Wstatic-in-inline]": Some semantics around
  `inline` have changed between C89 and C99, and gcc and clang seem
  to disagree on how strict they should be about them. Solution
  chosen is to use `-Wnostatic-in-inline` command line option for
  clang.

* "implicit conversion turns floating-point number into integer:
  'double' to 'bool' [-Wfloat-conversion]": `if (fmod (..., ...))`
  was used at different places, which is not nice anyway, thus the
  return value is compared explicitly against `ECMA_NUMBER_ZERO`.

* "format string is not a string literal [-Wformat-nonliteral]":
  Console and log port I/O functions have a printf-like interface,
  and the default implementations actually pass both format string
  and the remaining arguments to a vfprintf. However, clang is
  strict about the format string parameter of vfprintf and expects
  a literal there. By annotating the port I/O functions with
  `__attribute__ ((format (printf, ..., ...)))`, clang will check
  the format string being a literal string earlier, when the port
  functions are called, and will not complain within them when
  vfprintf is called.
  (Actually, this has revealed an incorrect format string, which
  has been fixed as well.)

(There were also some single conversion errors not listed above.)

The patch was tested on OS X (where all warnings disappeared), but
it should help clang compilation on other OS's as well.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-01 15:16:02 +02:00
László Langó 2a354b25a8 Add documentation to port API
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-09-01 14:32:31 +02:00
Zoltan Herczeg da47dedaed Add 32 bit compressed pointer support.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-01 04:16:54 -07:00
Zsolt Borbély 9ca78d380f [nuttx-stm32f4] Fix jerry_port_log function
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-09-01 12:51:27 +02:00
Youngil Choi 2c78ee7f54 FunctionExpression name binding should be immutable
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2016-09-01 14:50:26 +09:00
Youngil Choi 260b967853 SplitMatch operation should not set its return array element with [[Put]]
Related issue: #1076

JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2016-09-01 11:05:07 +09:00
Sergio Martinez 1ab45a1a2f Remove problems with gettimeofday, newlibc and zephyr SDK
Fix Zephyr build

With the changes to the zephyr sdk, gettimeofday is being guarded
by XOPEN_SOURCE_EXTENDED which requires at least 700 on XOPEN_SOURCE to be active

This little patch also helps on removing most of the warnings we had before
related to that issue.

More info on this feature:
http://man7.org/linux/man-pages/man7/feature_test_macros.7.html

Another option was to enable _GNU_SOURCE for this port.

There are still some harmless warnings related to __sputc_r for which we still require
the convertion warning.

Tested on qemu_cortex_m3, qemu_x86, arduino_101 and frdm_k64f.
Zephyr Sdk 0.8.2, Zephyr 1.5.0-rc4 & Zephyr ec39b216

Closes #1311.

JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
2016-08-31 17:13:45 +02:00
István Kádár 6666927799 All-in-one build friendly jerry-libm.
Define constants are undefined at the end of the corresponding files of jerry-libm supporting all-in-one build.

JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
2016-08-31 16:28:54 +02:00
Zoltan Herczeg 548b3b98c2 Change return value to ecma_value_t for getting internal properties.
Removing a lot of ECMA_PROPERTY_VALUE_PTR macro calls. The only drawback
is free callbacks for native objects cannot be deleted anymore. Redefining
a free callback is a rare case, so this trade-of is acceptable.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-08-31 06:13:00 -07:00
Youngil Choi bfbe1821b5 vm_op_set_value should be able to throw error when ecma_op_to_string throws
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2016-08-31 21:06:54 +09:00
Peter Gal 17d1d37cca Improve the Curie build file generator a bit
Works with python 2 and 3.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.u-szeged@partner.samsung.com
2016-08-31 11:35:21 +02:00
Zsolt Borbély 18f9308cd6 Minor stylefix for targets/nuttx-stm32f4/README.md
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-08-31 09:47:30 +02:00
Akos Kiss da7abc55f9 Disallow failures of Travis CI jobs on OS X
Related issue: #1296

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-30 16:36:04 +02:00
Akos Kiss 7f6911103f Update the prerequisites documentation
* Split list into two: what is needed for building and what is
  needed for development only.
* Remove g++ from install list.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-30 10:19:14 +02:00
Youngil Choi 9f65b76013 Fix bug in for-in bytecode replacement
JerryScript-DCO-1.0-Signed-off-by: Youngil Choi duddlf.choi@samsung.com
2016-08-30 16:57:49 +09:00
Akos Kiss a6d2e792f8 Improve the build system
* Remove JERRY_CORE CMake option: the building of the core
  JerryScript library should not be optional.
* Fix wording of comments, status and error messages.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-30 09:10:30 +02:00
Yanhui Shen ba2b7dd13f Use C99's variable length array instead of alloca
JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2016-08-30 14:29:19 +08:00
Akos Kiss 8edab96162 Fix JMEM_HEAP_END_OF_LIST for pointers larger than 32 bits
For 64 bit pointers, 0xffffffff as end-of-list marker pointer does
not work, as the marker is expected to be greater than the start
address of the heap area (and also max 0xffffffff away), but on 64
bit systems, the heap can start on higher addresses, i.e., above
0x100000000.

This patch changes JMEM_HEAP_END_OF_LIST from pointer to offset.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-08-29 12:23:48 +02:00
Geoff Gustafson 7c50dc1691 Assert that pointer passed to jmem_pools_free is not NULL
If a NULL pointer is passed here, the list of free chunks gets lost.

JerryScript-DCO-1.0-Signed-off-by: Geoff Gustafson geoff@linux.intel.com
2016-08-29 12:20:13 +02:00
Robert Sipka 8ea60072b3 Remove unused JERRY_ENABLE_PRETTY_PRINTER from the build system.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-08-29 10:24:01 +02:00
3700 changed files with 262823 additions and 86770 deletions
+87
View File
@@ -0,0 +1,87 @@
---
Language: Cpp
AlignAfterOpenBracket: Align
AlignConsecutiveMacros: true
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: AllDefinitions
AlwaysBreakBeforeMultilineStrings: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: true
AfterControlStatement: Always
AfterEnum: true
AfterFunction: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakStringLiterals: true
ColumnLimit: 120
ContinuationIndentWidth: 2
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '<windows.h>'
Priority: 0
- Regex: '<[-./a-z]*>'
Priority: 1
- Regex: '"jerryscript[-.a-z]*"'
Priority: 2
- Regex: '"ecma[-.a-z]*"'
Priority: 3
- Regex: '.*'
Priority: 4
IndentCaseLabels: true
IndentGotoLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: Always
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
Standard: Auto
StatementMacros:
- JERRY_ASSERT
- JERRY_STATIC_ASSERT
- JERRY_UNREACHABLE
TabWidth: 0
UseCRLF: false
UseTab: Never
...
+77
View File
@@ -0,0 +1,77 @@
---
name: Bug report
about: Create a report to help us improve
---
First of all, when reporting a bug, give the issue a descriptive title.
In the body of the issue, optionally give a free-form text description of the
bug. Give the context necessary for others to understand the problem.
Then, provide information necessary to reproduce the bug.
Omit sections that are irrelevant for the bug report, but note that information
like git revision, build platform, build command, and test case are required in
almost all cases.
###### JerryScript revision
Identify the git hash(es) or tag(s) where the issue was observed.
###### Build platform
Name the build platform. E.g., copy the output of
`echo "$(lsb_release -ds) ($(uname -mrs))"` (on Linux),
`echo "$(sw_vers -productName) $(sw_vers -productVersion) ($(uname -mrs))"` (on macOS), or
`python -c "import platform; print(platform.platform())"` (should work everywhere).
###### Build steps
Describe how to build JerryScript. Give all the necessary details of the build
(e.g., environment variables, command(s), profile, command line options, etc.).
E.g.:
```sh
tools/build.py --clean --debug
```
Or:
```sh
mkdir build && cmake -H. -Bbuild && make -C build
```
Even if the bug was originally observed when JerryScript was integrated into a
larger project, try to reproduce it with as few external code as possible,
preferably by building the `jerry` command line tool.
###### Build log
Copy the build log if the reported issue is a build problem. Do a verbose build
if necessary. Try and trim the log to relevant parts.
###### Test case
Give the JavaScript input that should be passed to the engine to trigger the
bug. Try and post a reduced test case that is minimally necessary to reproduce
the issue. As a rule of thumb, use Markdown's fenced code block syntax for the
test case. Attach the file (renamed to .txt) if the test case contains
'problematic' bytes that cannot be copied in the bug report directly.
###### Execution platform
Unnecessary if the same as the build platform.
###### Execution steps
List the steps that trigger the bug.
E.g., if a bug is snapshot-specific:
```sh
build/bin/jerry-snapshot generate -o testcase.js.snapshot testcase.js
build/bin/jerry --exec-snapshot testcase.js.snapshot
```
Unnecessary if trivial (i.e., `build/bin/jerry testcase.js`).
###### Output
Copy relevant output from the standard output and/or error channels.
###### Backtrace
In case of a crash (assertion failure, etc.), try to copy the backtrace from a
debugger at the point of failure.
###### Expected behavior
Describe what should happen instead of current behavior. Unnecessary if trivial
(e.g., in case of a crash, the trivial expected behavior is not to crash).
+19
View File
@@ -0,0 +1,19 @@
**PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING**
Before submitting a PR, please, make sure that:
- Changes are in a separate branch, not in master.
- The branch contains only one commit on top of master (if not, squash them into
one commit).
- The commit has a descriptive commit message with a concise title (first line).
- The commit message contains `fixes #XXXX` or `closes #XXXX` to auto-close the
issue(s) that the PR fixes (if any).
- Tests for the changes have been added (for bug fixes / features).
- Documentation has been added / updated (if applicable).
- All new and existing tests passed locally (if not, fix them first and amend
the commit).
IMPORTANT: Please review the CONTRIBUTING.md file for detailed contributing
guidelines.
**PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING**
+401
View File
@@ -0,0 +1,401 @@
name: JerryScript CI
on: [push, pull_request]
env:
RUNNER: tools/run-tests.py
jobs:
Checks:
runs-on: ubuntu-22.04 # needed for checker version stability
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- run: sudo apt update
- run: sudo apt install pylint doxygen cppcheck clang-format-15
- run: $RUNNER --check-signed-off=gh-actions
if: ${{ always() }}
- run: $RUNNER --check-doxygen
if: ${{ always() }}
- run: $RUNNER --check-format
if: ${{ always() }}
- run: $RUNNER --check-license
if: ${{ always() }}
- run: $RUNNER --check-strings
if: ${{ always() }}
- run: $RUNNER --check-pylint
if: ${{ always() }}
- run: $RUNNER --check-cppcheck
if: ${{ always() }}
Linux_x86-64_Build_Correctness_Debugger_Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: $RUNNER -q --jerry-tests
- run: $RUNNER -q --jerry-tests --build-debug
- run: $RUNNER -q --jerry-debugger
- run: $RUNNER -q --jerry-debugger --build-debug
Linux_x86_cpointer-32bit_Build_Correctness_Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-multilib
- run: $RUNNER -q --jerry-tests --buildoptions=--compile-flag=-m32,--cpointer-32bit=on
- run: $RUNNER -q --jerry-tests --buildoptions=--compile-flag=-m32,--cpointer-32bit=on --build-debug
Win_x86-64_Conformance_Tests_ESNext:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- run: python $env:RUNNER --test262 update
Win_x86-64_Conformance_Tests_ESNext_Debug:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- run: python $env:RUNNER --test262 update --build-debug
Win_x86-64_Tests-MINGW:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-python
mingw-w64-x86_64-cmake
mingw-w64-x86_64-make
mingw-w64-x86_64-toolchain
- run: python $RUNNER -q --jerry-tests
- run: python $RUNNER -q --unittests --build-config=''
# FIXME: enable it with upgrade valgrind - run: python $RUNNER -q --buildoption-test
Win_x86-64_Tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- run: python $env:RUNNER -q --jerry-tests
- run: python $env:RUNNER -q --unittests
- run: python $env:RUNNER -q --buildoption-test
Win_x86-64_Tests_Debug:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- run: python $env:RUNNER -q --jerry-tests --build-debug
- run: python $env:RUNNER -q --unittests --build-debug
- run: python $env:RUNNER -q --buildoption-test --build-debug
OSX_x86-64_Build_Correctness_Unit_Tests:
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: $RUNNER -q --jerry-tests
- run: $RUNNER -q --unittests
OSX_x86-64_Build_Correctness_Unit_Tests_Debug:
runs-on: macos-13
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: $RUNNER -q --jerry-tests --build-debug
- run: $RUNNER -q --unittests --build-debug
Linux_x86-64_Build_Option_Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-multilib
- run: $RUNNER --buildoption-test
Conformance_Tests_ESNext:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: $RUNNER --test262 update
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Test262-ESNext-results
path: |
build/tests/test262_tests_esnext/local/bin/test262.report
Conformance_Tests_ESNext_Debug_A:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: $RUNNER --test262 update --build-debug --test262-test-list=built-ins,annexB,harness,intl402
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Test262-ESNext-Debug-A-results
path: |
build/tests/test262_tests_esnext-debug/local/bin/test262.report
Conformance_Tests_ESNext_Debug_B:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: $RUNNER --test262 update --build-debug --test262-test-list=language
- uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: Test262-ESNext-Debug-B-results
path: |
build/tests/test262_tests_esnext-debug/local/bin/test262.report
Unit_Tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: $RUNNER -q --unittests
- run: $RUNNER -q --unittests --build-debug
Clang_Unit_Build_Option_Tests:
runs-on: ubuntu-latest
env:
CC: clang
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-multilib
- run: $RUNNER -q --unittests
# clang has bug in supporting lto
- run: $RUNNER -q --buildoption-test --buildoptions=--lto=off
ASAN_Tests:
runs-on: ubuntu-latest
env:
ASAN_OPTIONS: detect_stack_use_after_return=1:check_initialization_order=true:strict_init_order=true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-multilib
- run: >-
$RUNNER -q --jerry-tests
--buildoptions=--stack-limit=0,--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold
--skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-4870.js,regression-test-issue-4901.js,regression-test-issue-4848.js,regression-test-issue-4890.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js,regression-test-issue-3785.js,proxy-evil-recursion.js,regression-test-issue-5101.js
ASAN_Tests_Debug:
runs-on: ubuntu-latest
env:
ASAN_OPTIONS: detect_stack_use_after_return=1:check_initialization_order=true:strict_init_order=true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-multilib
- run: >-
$RUNNER -q --jerry-tests --build-debug
--buildoptions=--stack-limit=0,--compile-flag=-fsanitize=address,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--compile-flag=-O2,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold
--skip-list=parser-oom.js,parser-oom2.js,stack-limit.js,regression-test-issue-4870.js,regression-test-issue-4901.js,regression-test-issue-4848.js,regression-test-issue-4890.js,regression-test-issue-2190.js,regression-test-issue-2258-2963.js,regression-test-issue-2448.js,regression-test-issue-2905.js,regression-test-issue-3785.js,proxy-evil-recursion.js,regression-test-issue-5101.js
UBSAN_Tests:
runs-on: ubuntu-latest
env:
UBSAN_OPTIONS: print_stacktrace=1
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-multilib
- run: >-
$RUNNER -q --jerry-tests
--buildoptions=--compile-flag=-fsanitize=undefined,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold
--skip-list=parser-oom.js,parser-oom2.js
- run: >-
$RUNNER -q --jerry-tests --build-debug
--buildoptions=--compile-flag=-fsanitize=undefined,--compile-flag=-m32,--compile-flag=-fno-omit-frame-pointer,--compile-flag=-fno-common,--debug,--system-allocator=on,--linker-flag=-fuse-ld=gold
--skip-list=parser-oom.js,parser-oom2.js
Linux_ARMv7l_Tests:
runs-on: ubuntu-latest
env:
RUNTIME: qemu-arm-static
TIMEOUT: 300
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
- run: >-
$RUNNER -q --jerry-tests
--buildoptions=--toolchain=cmake/toolchain_linux_armv7l.cmake,--linker-flag=-static
Linux_ARMv7l_Tests_Debug:
runs-on: ubuntu-latest
env:
RUNTIME: qemu-arm-static
TIMEOUT: 300
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static
- run: >-
$RUNNER -q --jerry-tests --build-debug
--buildoptions=--toolchain=cmake/toolchain_linux_armv7l.cmake,--linker-flag=-static
Linux_AArch64_Tests:
runs-on: ubuntu-latest
env:
RUNTIME: qemu-aarch64-static
TIMEOUT: 300
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-aarch64-linux-gnu libc6-dev-armhf-cross qemu-user-static
- run: >-
$RUNNER -q --jerry-tests
--buildoptions=--toolchain=cmake/toolchain_linux_aarch64.cmake,--linker-flag=-static
Linux_AArch64_Tests_Debug:
runs-on: ubuntu-latest
env:
RUNTIME: qemu-aarch64-static
TIMEOUT: 300
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-aarch64-linux-gnu libc6-dev-armhf-cross qemu-user-static
- run: >-
$RUNNER -q --jerry-tests --build-debug
--buildoptions=--toolchain=cmake/toolchain_linux_aarch64.cmake,--linker-flag=-static
MbedOS_K64F_Build_Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-arm-none-eabi ninja-build
- run: make -f ./targets/os/mbedos/Makefile.travis install
- run: make -f ./targets/os/mbedos/Makefile.travis script
Zephyr_STM32F4_Build_Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gperf dfu-util device-tree-compiler
- run: make -f ./targets/os/zephyr/Makefile.travis install
- run: make -f ./targets/os/zephyr/Makefile.travis script
NuttX_STM32F4_Build_Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.6'
- run: sudo apt update
- run: sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi gperf
- run: make -f ./targets/os/nuttx/Makefile.travis install-noapt
- run: make -f ./targets/os/nuttx/Makefile.travis script
RIOT_STM32F4_Build_Test:
runs-on: ubuntu-latest
env:
CC: clang
steps:
- uses: actions/checkout@v2
- run: sudo apt -y install clang gcc-arm-none-eabi
- run: make -f ./targets/os/riot/Makefile.travis install-noapt
- run: make -f ./targets/os/riot/Makefile.travis script
ESP8266_RTOS_SDK_Build_Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '>=3.8'
- run: make -f ./targets/baremetal-sdk/espressif/esp8266-rtos-sdk/Makefile.travis install-noapt
- run: make -f ./targets/baremetal-sdk/espressif/esp8266-rtos-sdk/Makefile.travis script
ESP_IDF_Build_Test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: '==3.8'
- run: make -f ./targets/baremetal-sdk/espressif/esp-idf/Makefile.travis install-noapt
- run: make -f ./targets/baremetal-sdk/espressif/esp-idf/Makefile.travis script
Notification:
runs-on: ubuntu-latest
if: false && github.event_name == 'push' && github.repository == 'jerryscript-project/jerryscript'
steps:
- uses: rectalogic/notify-irc@v1
with:
channel: '#jerryscript'
nickname: jerryscript-notification
message: |
@${{ github.actor }}: ${{ github.repository }} (${{ github.ref }}#${{ github.sha }})
${{ join(github.event.commits.*.message) }}
${{ github.event.compare }}
+12 -11
View File
@@ -1,11 +1,11 @@
# Produced files
.mbedignore
build/*
# IDE related files
nbproject
**.sublime-project
**.sublime-workspace
*.sublime-project
*.sublime-workspace
.idea
# Random Trash
@@ -14,27 +14,28 @@ nbproject
*~
core
vgcore.*
**.orig
**.directory
**.patch
*.orig
*.directory
*.patch
.tags*
cscope.*
__pycache__
*.pyc
.DS_Store
# ctags and ID database
tags
ID
# targets
jerry_targetjs.h
targets/mbedk64f/libjerry
targets/mbedk64f/build
targets/mbedk64f/yotta_modules
targets/mbedk64f/yotta_targets
jerry-targetjs.h
.output
targets/esp8266/output.map
targets/esp8266/libs
# Generated documentation
docs/doxygen
# Tests
tests/test262/
.vs
-30
View File
@@ -1,30 +0,0 @@
language: c
os: linux
dist: trusty
sudo: required
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tools/apt-get-install-deps.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then tools/apt-get-install-qemu-arm.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then tools/brew-install-deps.sh; fi
install:
script: "python tools/run-tests.py $OPTS"
env:
- OPTS="--check-signed-off --check-cppcheck --check-vera"
- OPTS="--jerry-tests --jerry-test-suite"
- OPTS="--jerry-tests --jerry-test-suite --toolchain=cmake/toolchain_linux_armv7l.cmake" TIMEOUT=300
- OPTS=--buildoption-test
- OPTS=--unittests
matrix:
include:
- os: osx
env: OPTS="--jerry-tests --jerry-test-suite"
- os: osx
env: OPTS=--unittests
allow_failures:
- os: osx
+233 -133
View File
@@ -1,5 +1,4 @@
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
# Copyright 2016 University of Szeged.
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,73 +12,154 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required (VERSION 2.8.12)
project (Jerry C ASM)
cmake_minimum_required (VERSION 3.10)
project (Jerry C)
if(NOT DEFINED PYTHON)
set(PYTHON "python")
endif()
# Determining version
execute_process(COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/tools/version.py
OUTPUT_VARIABLE JERRY_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE)
# Determining platform
set(PLATFORM "${CMAKE_SYSTEM_NAME}")
string(TOUPPER "${PLATFORM}" PLATFORM)
# Remove rdynamic option
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS )
# Determining compiler
if(MSVC)
set(USING_MSVC 1)
endif()
# Components
set(JERRY_CORE ON CACHE BOOL "Use jerry-core?")
set(JERRY_LIBC ON CACHE BOOL "Use jerry-libc?")
set(JERRY_LIBM ON CACHE BOOL "Use jerry-libm?")
set(JERRY_CMDLINE ON CACHE BOOL "Use jerry command line tool?")
set(UNITTESTS OFF CACHE BOOL "Use unit tests?")
if(CMAKE_C_COMPILER_ID MATCHES "GNU")
set(USING_GCC 1)
endif()
# Clang may support for MSVC
if(NOT USING_MSVC AND CMAKE_C_COMPILER_ID MATCHES "Clang")
set(USING_CLANG 1)
endif()
if(CMAKE_C_COMPILER_ID MATCHES "TI")
set(USING_TI 1)
endif()
# Determining build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "MinSizeRel")
endif()
# Optional components
set(JERRY_CMDLINE ON CACHE BOOL "Build jerry command line tool?")
set(JERRY_CMDLINE_TEST OFF CACHE BOOL "Build jerry test command line tool?")
set(JERRY_CMDLINE_SNAPSHOT OFF CACHE BOOL "Build jerry snapshot command line tool?")
set(JERRY_LIBFUZZER OFF CACHE BOOL "Build jerry with libfuzzer support?")
set(JERRY_PORT ON CACHE BOOL "Build default jerry port implementation?")
set(JERRY_EXT ON CACHE BOOL "Build jerry-ext?")
set(JERRY_MATH OFF CACHE BOOL "Build and use jerry-math?")
set(UNITTESTS OFF CACHE BOOL "Build unit tests?")
set(DOCTESTS OFF CACHE BOOL "Build doc tests?")
# Optional build settings
set(PORT_DIR "${CMAKE_SOURCE_DIR}/targets/default" CACHE STRING "Should we use default or external port?")
set(COMPILER_DEFAULT_LIBC OFF CACHE BOOL "Enable compiler default libc?")
set(ENABLE_LTO OFF CACHE BOOL "Enable LTO build?")
set(ENABLE_ALL_IN_ONE ON CACHE BOOL "Enable all-in-one build?")
set(ENABLE_STRIP ON CACHE BOOL "Discards all symbols from object files?")
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries?")
set(ENABLE_AMALGAM OFF CACHE BOOL "Enable amalgamated build?")
set(ENABLE_LTO ON CACHE BOOL "Enable LTO build?")
set(ENABLE_STRIP ON CACHE BOOL "Enable stripping all symbols from release binary?")
set(ENABLE_COMPILE_COMMANDS ON CACHE BOOL "Enable generating compile_commands.json?")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
if(USING_MSVC)
set(ENABLE_STATIC_CRT OFF CACHE BOOL "Enable MSVC static CRT?")
endif()
# Option overrides
if(NOT USING_CLANG)
set(JERRY_LIBFUZZER OFF)
set(JERRY_LIBFUZZER_MESSAGE " (FORCED BY COMPILER)")
endif()
if(JERRY_CMDLINE OR JERRY_CMDLINE_TEST OR JERRY_CMDLINE_SNAPSHOT OR JERRY_LIBFUZZER OR UNITTESTS OR DOCTESTS)
set(JERRY_PORT ON)
set(JERRY_PORT_MESSAGE " (FORCED BY CMDLINE OR LIBFUZZER OR TESTS)")
endif()
if(JERRY_CMDLINE OR DOCTESTS)
set(JERRY_EXT ON)
set(JERRY_EXT_MESSAGE " (FORCED BY CMDLINE OR TESTS)")
endif()
if("${PLATFORM}" STREQUAL "DARWIN")
set(ENABLE_LTO "OFF")
set(ENABLE_ALL_IN_ONE "ON")
set(JERRY_LIBC "OFF")
set(JERRY_LIBM "OFF")
set(COMPILER_DEFAULT_LIBC "ON")
set(ENABLE_LTO OFF)
set(ENABLE_STRIP OFF)
set(ENABLE_LTO_MESSAGE " (FORCED BY PLATFORM)")
set(ENABLE_STRIP_MESSAGE " (FORCED BY PLATFORM)")
endif()
if(JERRY_LIBC AND COMPILER_DEFAULT_LIBC)
message(FATAL_ERROR "JERRY_LIBC and COMPILER_DEFAULT_LIBC is enabled at the same time!")
if("${PLATFORM}" STREQUAL "ESP-IDF")
set(ENABLE_LTO OFF)
set(ENABLE_STRIP OFF)
set(ENABLE_LTO_MESSAGE " (FORCED BY PLATFORM)")
set(ENABLE_STRIP_MESSAGE " (FORCED BY PLATFORM)")
endif()
if(USING_TI)
set(ENABLE_STRIP OFF)
set(ENABLE_STRIP_MESSAGE " (FORCED BY COMPILER)")
endif()
if(USING_MSVC)
set(ENABLE_STRIP OFF)
set(ENABLE_STRIP_MESSAGE " (FORCED BY COMPILER)")
endif()
if(CYGWIN OR MINGW OR MSYS)
set(ENABLE_LTO OFF)
set(ENABLE_LTO_MESSAGE " (FORCED BY PLATFORM)")
endif()
# Generate compile_commands.json
set(CMAKE_EXPORT_COMPILE_COMMANDS ${ENABLE_COMPILE_COMMANDS})
# Status messages
message(STATUS "CMAKE_SYSTEM_NAME " ${CMAKE_SYSTEM_NAME})
message(STATUS "CMAKE_SYSTEM_PROCESSOR " ${CMAKE_SYSTEM_PROCESSOR})
message(STATUS "CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE})
message(STATUS "JERRY_CORE " ${JERRY_CORE})
message(STATUS "JERRY_LIBC " ${JERRY_LIBC})
message(STATUS "JERRY_LIBM " ${JERRY_LIBM})
message(STATUS "JERRY_CMDLINE " ${JERRY_CMDLINE})
message(STATUS "UNITTESTS " ${UNITTESTS})
message(STATUS "PORT_DIR " ${PORT_DIR})
message(STATUS "COMPILER_DEFAULT_LIBC " ${COMPILER_DEFAULT_LIBC})
message(STATUS "ENABLE_LTO " ${ENABLE_LTO})
message(STATUS "ENABLE_ALL_IN_ONE " ${ENABLE_ALL_IN_ONE})
message(STATUS "ENABLE_STRIP " ${ENABLE_STRIP})
message(STATUS "CMAKE_BUILD_TYPE " ${CMAKE_BUILD_TYPE})
message(STATUS "CMAKE_C_COMPILER_ID " ${CMAKE_C_COMPILER_ID})
message(STATUS "CMAKE_SYSTEM_NAME " ${CMAKE_SYSTEM_NAME})
message(STATUS "CMAKE_SYSTEM_PROCESSOR " ${CMAKE_SYSTEM_PROCESSOR})
message(STATUS "BUILD_SHARED_LIBS " ${BUILD_SHARED_LIBS})
message(STATUS "ENABLE_AMALGAM " ${ENABLE_AMALGAM} ${ENABLE_AMALGAM_MESSAGE})
message(STATUS "ENABLE_LTO " ${ENABLE_LTO} ${ENABLE_LTO_MESSAGE})
message(STATUS "ENABLE_STRIP " ${ENABLE_STRIP} ${ENABLE_STRIP_MESSAGE})
message(STATUS "ENABLE_STATIC_CRT " ${ENABLE_STATIC_CRT})
message(STATUS "ENABLE_COMPILE_COMMANDS " ${ENABLE_COMPILE_COMMANDS})
message(STATUS "JERRY_VERSION " ${JERRY_VERSION})
message(STATUS "JERRY_CMDLINE " ${JERRY_CMDLINE} ${JERRY_CMDLINE_MESSAGE})
message(STATUS "JERRY_CMDLINE_TEST " ${JERRY_CMDLINE_TEST} ${JERRY_CMDLINE_TEST_MESSAGE})
message(STATUS "JERRY_CMDLINE_SNAPSHOT " ${JERRY_CMDLINE_SNAPSHOT} ${JERRY_CMDLINE_SNAPSHOT_MESSAGE})
message(STATUS "JERRY_LIBFUZZER " ${JERRY_LIBFUZZER} ${JERRY_LIBFUZZER_MESSAGE})
message(STATUS "JERRY_PORT " ${JERRY_PORT} ${JERRY_PORT_MESSAGE})
message(STATUS "JERRY_EXT " ${JERRY_EXT} ${JERRY_EXT_MESSAGE})
message(STATUS "JERRY_MATH " ${JERRY_MATH} ${JERRY_MATH_MESSAGE})
message(STATUS "UNITTESTS " ${UNITTESTS})
message(STATUS "DOCTESTS " ${DOCTESTS})
# Setup directories
# Project binary dir
set(PROJECT_BINARY_DIR "${CMAKE_BINARY_DIR}")
# Note: This mimics a conventional file system layout in the build directory for
# the sake of convenient location of build artefacts. Proper installation to
# traditional locations is also supported, e.g., to /usr/local.
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/")
# Library output directory
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/")
# Executable output directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin/")
# Archive targets output Directory
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib/")
# Remove rdynamic option
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS )
# Compile/link flags
# Helper macros
@@ -96,9 +176,7 @@ endmacro()
macro(jerry_add_compile_warnings)
foreach(_warning ${ARGV})
jerry_add_compile_flags(-W${_warning})
if(CMAKE_COMPILER_IS_GNUCC)
jerry_add_compile_flags(-Werror=${_warning})
endif()
jerry_add_compile_flags(-Werror=${_warning})
endforeach()
endmacro()
@@ -106,88 +184,101 @@ macro(jerry_add_link_flags)
jerry_add_flags(LINKER_FLAGS_COMMON ${ARGV})
endmacro()
# build mode specific compile/link flags
set(CMAKE_C_FLAGS_RELEASE "-Os")
# Architecture-specific compile/link flags
jerry_add_compile_flags(${FLAGS_COMMON_ARCH})
jerry_add_flags(CMAKE_EXE_LINKER_FLAGS ${FLAGS_COMMON_ARCH})
# LTO
if(ENABLE_LTO)
jerry_add_compile_flags(-flto)
jerry_add_link_flags(-flto)
if(CMAKE_COMPILER_IS_GNUCC)
if(NOT "${PLATFORM}" STREQUAL "DARWIN")
jerry_add_compile_flags(-fno-fat-lto-objects)
endif()
if(USING_GCC OR USING_CLANG)
jerry_add_compile_flags(-flto)
jerry_add_link_flags(-flto)
endif()
if(USING_GCC)
jerry_add_compile_flags(-fno-fat-lto-objects)
# Use gcc-ar and gcc-ranlib to support LTO
set(CMAKE_AR "gcc-ar")
set(CMAKE_RANLIB "gcc-ranlib")
endif()
endif()
# Define _BSD_SOURCE if we use default port and compiler default libc
if(${PORT_DIR} STREQUAL "${CMAKE_SOURCE_DIR}/targets/default" AND COMPILER_DEFAULT_LIBC)
set(DEFINES_JERRY ${DEFINES_JERRY} _BSD_SOURCE)
endif()
# Imported targets prefix
set(PREFIX_IMPORTED_LIB imported_)
# Imported libraries
if(("${PLATFORM}" STREQUAL "DARWIN") AND (NOT CMAKE_COMPILER_IS_GNUCC))
# libclang_rt.osx
set(IMPORTED_LIB "${PREFIX_IMPORTED_LIB}libclang_rt.osx")
add_library(${IMPORTED_LIB} STATIC IMPORTED)
execute_process(COMMAND ${CMAKE_C_COMPILER} ${FLAGS_COMMON_ARCH} -print-file-name=
OUTPUT_VARIABLE IMPORTED_LIBCLANG_RT_LOCATION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(IMPORTED_LIBCLANG_RT_LOCATION "${IMPORTED_LIBCLANG_RT_LOCATION}/lib/darwin/libclang_rt.osx.a")
set_property(TARGET ${IMPORTED_LIB}
PROPERTY IMPORTED_LOCATION ${IMPORTED_LIBCLANG_RT_LOCATION})
else()
# libgcc
set(IMPORTED_LIB "${PREFIX_IMPORTED_LIB}libgcc")
add_library(${IMPORTED_LIB} STATIC IMPORTED)
execute_process(COMMAND ${CMAKE_C_COMPILER} ${FLAGS_COMMON_ARCH} -print-file-name=libgcc.a
OUTPUT_VARIABLE IMPORTED_LIBGCC_LOCATION
OUTPUT_STRIP_TRAILING_WHITESPACE)
set_property(TARGET ${IMPORTED_LIB}
PROPERTY IMPORTED_LOCATION ${IMPORTED_LIBGCC_LOCATION})
if(USING_TI)
jerry_add_link_flags(-lto)
endif()
endif()
# Compiler / Linker flags
jerry_add_compile_flags(-fno-builtin)
if(("${PLATFORM}" STREQUAL "DARWIN"))
if("${PLATFORM}" STREQUAL "DARWIN")
jerry_add_link_flags(-lSystem)
else()
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Sqc <TARGET> <LINK_FLAGS> <OBJECTS>")
if("${CMAKE_C_COMPILER_ID}" STREQUAL "AppleClang")
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
else()
set(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
endif()
set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
elseif((NOT CYGWIN AND NOT MINGW AND NOT MSYS) AND (USING_GCC OR USING_CLANG))
jerry_add_link_flags(-Wl,-z,noexecstack)
endif()
# Turn off linking to compiler's default libc, in case jerry-libc or external is used
if(NOT COMPILER_DEFAULT_LIBC)
jerry_add_link_flags(-nostdlib)
endif()
# Turn off stack protector
jerry_add_compile_flags(-fno-stack-protector)
# Debug information
jerry_add_compile_flags(-g -gdwarf-4)
jerry_add_compile_warnings(all extra format-nonliteral init-self conversion sign-conversion format-security missing-declarations)
jerry_add_compile_flags(-Wno-stack-protector -Wno-attributes)
if(CMAKE_COMPILER_IS_GNUCC)
if(JERRY_LIBC)
jerry_add_compile_flags(-Werror)
if(USING_GCC OR USING_CLANG)
jerry_add_compile_flags(-std=c99 -pedantic)
if(JERRY_MATH)
jerry_add_compile_flags(-fno-builtin)
endif()
jerry_add_compile_warnings(logical-op)
else()
jerry_add_compile_flags(-Wno-nested-anon-types)
jerry_add_compile_warnings(all extra format-nonliteral init-self sign-conversion format-security missing-declarations shadow strict-prototypes undef old-style-definition)
if(NOT "${PLATFORM}" STREQUAL "WINDOWS")
jerry_add_compile_warnings(conversion)
endif()
jerry_add_compile_flags(-Wno-stack-protector -Wno-attributes -Werror)
endif()
if(USING_GCC)
jerry_add_compile_warnings(logical-op)
# TODO: Remove workaround for gcc 7 bug if the fallthrough comment detection is fixed.
if(CMAKE_C_COMPILER_VERSION VERSION_GREATER 7.0)
jerry_add_compile_flags(-Wno-implicit-fallthrough)
endif()
endif()
if(USING_CLANG)
jerry_add_compile_flags(-Wno-nested-anon-types -Wno-static-in-inline)
endif()
if(USING_TI)
jerry_add_compile_flags(--c99)
endif()
if(USING_MSVC)
jerry_add_link_flags(/OPT:NOREF)
# Disable MSVC warning 4996 globally because it stops us from using standard C functions.
jerry_add_compile_flags(/wd4996)
if(ENABLE_STATIC_CRT)
# Replace the existing /MD and /MDd values with /MT and /MTd.
set(COMPILER_FLAGS
CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE
CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE
)
foreach(_flag ${COMPILER_FLAGS})
string(REPLACE "/MD" "/MT" ${_flag} "${${_flag}}")
endforeach()
endif()
endif()
if(JERRY_LIBFUZZER)
jerry_add_compile_flags(-fsanitize=fuzzer-no-link)
endif()
# Strip binary
if(ENABLE_STRIP AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
jerry_add_link_flags(-s)
endif()
# External compiler & linker flags
if(DEFINED EXTERNAL_COMPILE_FLAGS)
jerry_add_compile_flags(${EXTERNAL_COMPILE_FLAGS})
endif()
@@ -196,35 +287,44 @@ if(DEFINED EXTERNAL_LINKER_FLAGS)
jerry_add_link_flags(${EXTERNAL_LINKER_FLAGS})
endif()
# C
jerry_add_compile_flags(-std=c99 -pedantic)
# Strip binary
if(ENABLE_STRIP AND NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
jerry_add_link_flags(-s)
endif()
# Jerry's libc
if(JERRY_LIBC)
add_subdirectory(jerry-libc)
endif()
# Used as placeholder to attach amalgamated build targets to
add_custom_target(amalgam)
# Jerry's libm
if(JERRY_LIBM)
add_subdirectory(jerry-libm)
if(JERRY_MATH)
add_subdirectory(jerry-math)
endif()
# Jerry's core
if(JERRY_CORE)
add_subdirectory(jerry-core)
add_subdirectory(jerry-core)
# Jerry's extension tools
if(JERRY_EXT)
add_subdirectory(jerry-ext)
endif()
# Jerry commandline tool
if(JERRY_CMDLINE)
# Jerry's default port implementation
if(JERRY_PORT)
add_subdirectory(jerry-port)
endif()
# Jerry command line tool
if(JERRY_CMDLINE OR JERRY_CMDLINE_TEST OR JERRY_CMDLINE_SNAPSHOT OR JERRY_LIBFUZZER)
add_subdirectory(jerry-main)
endif()
# Unittests
if(UNITTESTS)
add_subdirectory(tests/unit)
add_subdirectory(tests/unit-core)
if(JERRY_MATH)
add_subdirectory(tests/unit-math)
endif()
if(JERRY_EXT)
add_subdirectory(tests/unit-ext)
endif()
endif()
# Doctests
if(DOCTESTS)
add_subdirectory(tests/unit-doc)
endif()
+101
View File
@@ -0,0 +1,101 @@
# Contribution Guidelines
## Patch Submission Process
The following guidelines on the submission process are provided to help you be more effective when submitting code to the JerryScript project.
When development is complete, a patch set should be submitted via GitHub pull requests. A review of the patch set will take place. When accepted, the patch set will be integrated into the master branch, verified, and tested. It is then the responsibility of the authoring developer to maintain the code throughout its lifecycle.
Please submit all patches in public by opening a pull request. Patches sent privately to Maintainers and Committers will not be considered. Because the JerryScript Project is an Open Source project, be prepared for feedback and criticism-it happens to everyone-. If asked to rework your code, be persistent and resubmit after making changes.
### 1. Scope the patch
Smaller patches are generally easier to understand and test, so please submit changes in the smallest increments possible, within reason. Smaller patches are less likely to have unintended consequences, and if they do, getting to the root cause is much easier for you and the Maintainers and Committers. Additionally, smaller patches are much more likely to be accepted.
### 2. Ensure all files have a proper license header and copyright notice
Any code that you want to contribute to the project must be licensed under the [Apache License 2.0](LICENSE). Contributions under a different license can not be accepted. Each file should start with the following header:
```c
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
```
Adding copyright notices other than the project-wide notice ("Copyright JS Foundation and other contributors, http://js.foundation") is not permitted. The only exception is adding third-party code which requires copyright notices to be preserved. Adding third-party code to the project generally requires a strong justification.
### 3. Sign your work with the JerryScript [Developer's Certificate of Origin](DCO.md)
The sign-off is a simple line at the end of the commit message of the patch, which certifies that you wrote it or otherwise have the right to pass it on as an Open Source patch. The sign-off is required for a patch to be accepted.
We have the same requirements for using the signed-off-by process as the Linux kernel.
In short, you need to include a signed-off-by tag in every patch.
You should use your real name and email address in the format below:
> JerryScript-DCO-1.0-Signed-off-by: Random J Developer random@developer.example.org
"JerryScript-DCO-1.0-Signed-off-by:" this is a developer's certification that he or she has the right to submit the patch for inclusion into the project. It is an agreement to the JerryScript [Developer's Certificate of Origin](DCO.md). **Code without a proper signoff cannot be merged into the mainline.**
### 4. Open a GitHub [pull request](https://github.com/jerryscript-project/jerryscript/pulls)
You can find instructions about opening a pull request [here](https://help.github.com/articles/creating-a-pull-request).
### 5. What if my patch is rejected?
It happens all the time, for many reasons, and not necessarily because the code is bad. Take the feedback, adapt your code, and try again. Remember, the ultimate goal is to preserve the quality of the code and maintain the focus of the Project through intensive review.
Maintainers and Committers typically have to process a lot of submissions, and the time for any individual response is generally limited. If the reason for rejection is unclear, please ask for more information from the Maintainers and Committers.
If you have a solid technical reason to disagree with feedback and you feel that reason has been overlooked, take the time to thoroughly explain it in your response.
### 6. Code review
Code review can be performed by all the members of the Project (not just Maintainers and Committers). Members can review code changes and share their opinion through comments guided by the following principles:
* Discuss code; never discuss the code's author
* Respect and acknowledge contributions, suggestions, and comments
* Listen and be open to all different opinions
* Help each other
Changes are submitted via pull requests and only the Maintainers and Committers should approve or reject the pull request (note that only Maintainers can give binding review scores).
Changes should be reviewed in reasonable amount of time. Maintainers and Committers should leave changes open for some time (at least 1 full business day) so others can offer feedback. Review times increase with the complexity of the review.
## Tips on GitHub Pull Requests
* [Fork](https://guides.github.com/activities/forking) the GitHub repository and clone it locally
* Connect your local repository to the original upstream repository by adding it as a remote
* Create a [branch](https://guides.github.com/introduction/flow) for your edits
* Pull in upstream changes often to stay up-to-date so that when you submit your pull request, merge conflicts will be less likely
For more details, see the GitHub [fork syncing](https://help.github.com/articles/syncing-a-fork) guidelines.
## How to add the DCO line to every single commit automatically
It is easy to forget adding the DCO line to the end of every commit message. Fortunately there is a nice way to do it automatically. Once you've cloned the repository into your local machine, you can add `prepare commit message hook` in `.git/hooks` directory like this:
```
#!/usr/bin/env python
import sys
commit_msg_filepath = sys.argv[1]
with open(commit_msg_filepath, "r+") as f:
content = f.read()
f.seek(0, 0)
if "Signed-off-by" not in content:
f.write("\n\nJerryScript-DCO-1.0-Signed-off-by: <Your Name> <Your Email>\n%s" % content)
else:
f.write(content)
```
Please refer [Git Hooks](http://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) for more information.
+22
View File
@@ -0,0 +1,22 @@
# JerryScript Developer's Certificate of Origin
The JerryScript project uses the signed-off-by language and process to give us a clear chain of trust for every patch received.
> By making a contribution to this project, I certify that:
> (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
> (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
> (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
> (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project, under the same open source license.
We have the same requirements for using the signed-off-by process as the Linux kernel.
In short, you need to include a signed-off-by tag in the commit message of every patch.
You should use your real name and email address in the format below:
> JerryScript-DCO-1.0-Signed-off-by: Random J Developer random@developer.example.org
"JerryScript-DCO-1.0-Signed-off-by:" this is a developer's certification that he or she has the right to submit the patch for inclusion into the project. It is an agreement to the Developer's Certificate of Origin (above). **Code without a proper signoff cannot be merged into the mainline.**
+383 -140
View File
@@ -1,4 +1,4 @@
# Doxyfile 1.8.9.1
# Doxyfile 1.9.1
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
@@ -17,11 +17,11 @@
# Project related configuration options
#---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all text
# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
# for the list of possible encodings.
# This tag specifies the encoding used for all characters in the configuration
# file that follow. The default is UTF-8 which is also the encoding used for all
# text before the first occurrence of this tag. Doxygen uses libiconv (or the
# iconv built into libc) for the transcoding. See
# https://www.gnu.org/software/libiconv/ for the list of possible encodings.
# The default value is: UTF-8.
DOXYFILE_ENCODING = UTF-8
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME = "JerryScript"
PROJECT_NAME = JerryScript
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
@@ -58,7 +58,7 @@ PROJECT_LOGO =
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY = "docs/doxygen"
OUTPUT_DIRECTORY = docs/doxygen
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
@@ -93,6 +93,14 @@ ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all generated output in the proper direction.
# Possible values are: None, LTR, RTL and Context.
# The default value is: None.
OUTPUT_TEXT_DIRECTION = None
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
# descriptions after the members that are listed in the file and class
# documentation (similar to Javadoc). Set to NO to disable this.
@@ -179,6 +187,16 @@ SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = YES
# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line
# such as
# /***************
# as being the beginning of a Javadoc-style comment "banner". If set to NO, the
# Javadoc-style will behave just like regular comments and it will not be
# interpreted by doxygen.
# The default value is: NO.
JAVADOC_BANNER = NO
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
@@ -199,6 +217,14 @@ QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
# By default Python docstrings are displayed as preformatted text and doxygen's
# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the
# doxygen's special commands can be used and the contents of the docstring
# documentation blocks is shown as doxygen documentation.
# The default value is: YES.
PYTHON_DOCSTRING = YES
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
# documentation from any documented member that it re-implements.
# The default value is: YES.
@@ -226,16 +252,15 @@ TAB_SIZE = 2
# will allow you to put the command \sideeffect (or @sideeffect) in the
# documentation, which will result in a user-defined paragraph with heading
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
# newlines (in the resulting output). You can put ^^ in the value part of an
# alias to insert a newline as if a physical newline was in the original file.
# When you need a literal { or } or , in the value part of an alias you have to
# escape them by means of a backslash (\), this can lead to conflicts with the
# commands \{ and \} for these it is advised to use the version @{ and @} or use
# a double escape (\\{ and \\})
ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
@@ -264,28 +289,40 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice
# sources only. Doxygen will then generate output that is more tailored for that
# language. For instance, namespaces will be presented as modules, types will be
# separated into more groups, etc.
# The default value is: NO.
OPTIMIZE_OUTPUT_SLICE = NO
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
# Fortran. In the later case the parser tries to guess whether the code is fixed
# or free formatted code, this is the default for Fortran type files), VHDL. For
# instance to make doxygen treat .inc files as Fortran files (default is PHP),
# and .f files as C (default is Fortran), use: inc=Fortran f=C.
# language is one of the parsers supported by doxygen: IDL, Java, JavaScript,
# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL,
# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran:
# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser
# tries to guess whether the code is fixed or free formatted code, this is the
# default for Fortran type files). For instance to make doxygen treat .inc files
# as Fortran files (default is PHP), and .f files as C (default is Fortran),
# use: inc=Fortran f=C.
#
# Note: For files without extension you can use no_extension as a placeholder.
#
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
# the files are not read by doxygen. When specifying no_extension you should add
# * to the FILE_PATTERNS.
#
# Note see also the list of default file extension mappings.
EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
# documentation. See http://daringfireball.net/projects/markdown/ for details.
# documentation. See https://daringfireball.net/projects/markdown/ for details.
# The output of markdown processing is further processed by doxygen, so you can
# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
# case of backward compatibilities issues.
@@ -293,6 +330,15 @@ EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
# to that level are automatically included in the table of contents, even if
# they do not have an id attribute.
# Note: This feature currently applies only to Markdown headings.
# Minimum value: 0, maximum value: 99, default value: 5.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 5
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by putting a % sign in front of the word or
@@ -318,7 +364,7 @@ BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen
# will parse them like normal C++ but will assume all classes use public instead
# of private inheritance when no explicit protection keyword is present.
# The default value is: NO.
@@ -341,7 +387,14 @@ IDL_PROPERTY_SUPPORT = YES
# all members of a group must be documented explicitly.
# The default value is: NO.
DISTRIBUTE_GROUP_DOC = NO
DISTRIBUTE_GROUP_DOC = YES
# If one adds a struct or class to a group and this option is enabled, then also
# any nested class or struct is added to the same group. By default this option
# is disabled and one has to add nested compounds explicitly via \ingroup.
# The default value is: NO.
GROUP_NESTED_COMPOUNDS = NO
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
# (for instance a group of public functions) to be put as a subgroup of that
@@ -397,6 +450,19 @@ TYPEDEF_HIDES_STRUCT = NO
LOOKUP_CACHE_SIZE = 0
# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use
# during processing. When set to 0 doxygen will based this on the number of
# cores available in the system. You can set it explicitly to a value larger
# than 0 to get more control over the balance between CPU load and processing
# speed. At this moment only the input processing can be done using multiple
# threads. Since this is still an experimental feature the default is set to 1,
# which efficively disables parallel processing. Please report any issues you
# encounter. Generating dot graphs in parallel is controlled by the
# DOT_NUM_THREADS setting.
# Minimum value: 0, maximum value: 32, default value: 1.
NUM_PROC_THREADS = 1
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
@@ -409,7 +475,7 @@ LOOKUP_CACHE_SIZE = 0
# normally produced when WARNINGS is set to YES.
# The default value is: NO.
EXTRACT_ALL = YES
EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
# be included in the documentation.
@@ -417,6 +483,12 @@ EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual
# methods of a class will be included in the documentation.
# The default value is: NO.
EXTRACT_PRIV_VIRTUAL = NO
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
@@ -454,6 +526,13 @@ EXTRACT_LOCAL_METHODS = YES
EXTRACT_ANON_NSPACES = NO
# If this flag is set to YES, the name of an unnamed parameter in a declaration
# will be determined by the corresponding definition. By default unnamed
# parameters remain unnamed in the output.
# The default value is: YES.
RESOLVE_UNNAMED_PARAMS = YES
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
# undocumented members inside documented classes or files. If set to NO these
# members will be included in the various overviews, but no documentation
@@ -471,8 +550,8 @@ HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO, these declarations will be
# included in the documentation.
# declarations. If set to NO, these declarations will be included in the
# documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO
@@ -491,11 +570,18 @@ HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
# names in lower-case letters. If set to YES, upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
# With the correct setting of option CASE_SENSE_NAMES doxygen will better be
# able to match the capabilities of the underlying filesystem. In case the
# filesystem is case sensitive (i.e. it supports files in the same directory
# whose names only differ in casing), the option must be set to YES to properly
# deal with such files in case they appear in the input. For filesystems that
# are not case sensitive the option should be be set to NO to properly deal with
# output files written for symbols that only differ in casing, such as for two
# classes, one named CLASS and the other named Class, and to also support
# references to files without having to specify the exact matching casing. On
# Windows (including Cygwin) and MacOS, users should typically set this option
# to NO, whereas on Linux or other Unix flavors it should typically be set to
# YES.
# The default value is: system dependent.
CASE_SENSE_NAMES = YES
@@ -682,7 +768,7 @@ LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
# extension is automatically appended if omitted. This requires the bibtex tool
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info.
# For LaTeX the style of the bibliography can be controlled using
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
@@ -727,10 +813,20 @@ WARN_IF_DOC_ERROR = YES
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return
# value. If set to NO, doxygen will only warn about wrong or incomplete
# parameter documentation, but not about the absence of documentation.
# parameter documentation, but not about the absence of documentation. If
# EXTRACT_ALL is set to YES then this flag will automatically be disabled.
# The default value is: NO.
WARN_NO_PARAMDOC = NO
WARN_NO_PARAMDOC = YES
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS
# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but
# at the end of the doxygen process doxygen will return with a non-zero status.
# Possible values are: NO, YES and FAIL_ON_WARNINGS.
# The default value is: NO.
WARN_AS_ERROR = NO
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which
@@ -755,30 +851,42 @@ WARN_LOGFILE =
# The INPUT tag is used to specify the files and/or directories that contain
# documented source files. You may enter file names like myfile.cpp or
# directories like /usr/src/myproject. Separate the files or directories with
# spaces.
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = jerry-core jerry-libc
INPUT = jerry-core \
jerry-ext \
jerry-port
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
# documentation (see: http://www.gnu.org/software/libiconv) for the list of
# possible encodings.
# documentation (see:
# https://www.gnu.org/software/libiconv/) for the list of possible encodings.
# The default value is: UTF-8.
INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank the
# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
# *.qsf, *.as and *.js.
# *.h) to filter out the source-files in the directories.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# read by doxygen.
#
# Note the list of default checked file patterns might differ from the list of
# default file extension mappings.
#
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment),
# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl,
# *.ucf, *.qsf and *.ice.
FILE_PATTERNS =
FILE_PATTERNS = *.h \
*.c
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
@@ -793,7 +901,19 @@ RECURSIVE = YES
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE =
# FIXME: None of these files are excluded light-heartedly. They should be
# removed one-by-one and warnings reported by doxygen should be fixed by those
# who are familiar with the undocumented parts.
EXCLUDE = jerry-core/ecma/base/ecma-globals.h \
jerry-core/ecma/operations/ecma-exceptions.h \
jerry-core/include/jerryscript-debugger-transport.h \
jerry-core/jcontext/jcontext.h \
jerry-core/parser/js/byte-code.h \
jerry-core/parser/js/common.h \
jerry-core/parser/js/js-lexer.h \
jerry-core/parser/js/js-parser-internal.h \
jerry-core/parser/regexp/re-parser.h \
jerry-core/vm/vm-stack.h
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
@@ -809,7 +929,7 @@ EXCLUDE_SYMLINKS = NO
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS =
EXCLUDE_PATTERNS = *.inc.h
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -862,6 +982,10 @@ IMAGE_PATH =
# Note that the filter must not add or remove lines; it is applied before the
# code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
INPUT_FILTER =
@@ -871,6 +995,10 @@ INPUT_FILTER =
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
# patterns match the file name, INPUT_FILTER is applied.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
FILTER_PATTERNS =
@@ -923,7 +1051,7 @@ INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
# function all documented functions referencing it will be listed.
# entity all documented functions referencing it will be listed.
# The default value is: NO.
REFERENCED_BY_RELATION = NO
@@ -955,12 +1083,12 @@ SOURCE_TOOLTIPS = YES
# If the USE_HTAGS tag is set to YES then the references to source code will
# point to the HTML generated by the htags(1) tool instead of doxygen built-in
# source browser. The htags tool is part of GNU's global source tagging system
# (see http://www.gnu.org/software/global/global.html). You will need version
# (see https://www.gnu.org/software/global/global.html). You will need version
# 4.8.6 or higher.
#
# To use it do the following:
# - Install the latest version of global
# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file
# - Make sure the INPUT points to the root of the source tree
# - Run doxygen as normal
#
@@ -983,16 +1111,22 @@ USE_HTAGS = NO
VERBATIM_HEADERS = YES
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
# cost of reduced performance. This can be particularly helpful with template
# rich C++ code for which doxygen's built-in parser lacks the necessary type
# information.
# clang parser (see:
# http://clang.llvm.org/) for more accurate parsing at the cost of reduced
# performance. This can be particularly helpful with template rich C++ code for
# which doxygen's built-in parser lacks the necessary type information.
# Note: The availability of this option depends on whether or not doxygen was
# compiled with the --with-libclang option.
# generated with the -Duse_libclang=ON option for CMake.
# The default value is: NO.
CLANG_ASSISTED_PARSING = NO
# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to
# YES then doxygen will add the directory of each input to the include path.
# The default value is: YES.
CLANG_ADD_INC_PATHS = YES
# If clang assisted parsing is enabled you can provide the compiler with command
# line options that you would normally use when invoking the compiler. Note that
# the include paths will already be set by doxygen for the files and directories
@@ -1001,6 +1135,19 @@ CLANG_ASSISTED_PARSING = NO
CLANG_OPTIONS =
# If clang assisted parsing is enabled you can provide the clang parser with the
# path to the directory containing a file called compile_commands.json. This
# file is the compilation database (see:
# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the
# options used when the source files were built. This is equivalent to
# specifying the -p option to a clang tool, such as clang-check. These options
# will then be passed to the parser. Any options specified with CLANG_OPTIONS
# will be added as well.
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse_libclang=ON option for CMake.
CLANG_DATABASE_PATH =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
@@ -1012,13 +1159,6 @@ CLANG_OPTIONS =
ALPHABETICAL_INDEX = YES
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
# which the alphabetical index list will be split.
# Minimum value: 1, maximum value: 20, default value: 5.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all classes will
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
# can be used to specify a prefix (or a list of prefixes) that should be ignored
@@ -1119,7 +1259,7 @@ HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
# this color. Hue is specified as an angle on a colorwheel, see
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
# https://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
# Minimum value: 0, maximum value: 359, default value: 220.
@@ -1155,6 +1295,17 @@ HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = NO
# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML
# documentation will contain a main index with vertical navigation menus that
# are dynamically created via JavaScript. If disabled, the navigation index will
# consists of multiple levels of tabs that are statically embedded in every HTML
# page. Disable this option to support browsers that do not have JavaScript,
# like the Qt help browser.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_DYNAMIC_MENUS = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded.
@@ -1178,13 +1329,14 @@ HTML_INDEX_NUM_ENTRIES = 100
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
# generated that can be used as input for Apple's Xcode 3 integrated development
# environment (see: http://developer.apple.com/tools/xcode/), introduced with
# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
# Makefile in the HTML output directory. Running make will produce the docset in
# that directory and running make install will install the docset in
# environment (see:
# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To
# create a documentation set, doxygen will generate a Makefile in the HTML
# output directory. Running make will produce the docset in that directory and
# running make install will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# for more information.
# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy
# genXcode/_index.html for more information.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
@@ -1223,8 +1375,8 @@ DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
# Windows.
# (see:
# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows.
#
# The HTML Help Workshop contains a compiler that can convert all HTML output
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
@@ -1254,7 +1406,7 @@ CHM_FILE =
HHC_LOCATION =
# The GENERATE_CHI flag controls if a separate .chi index file is generated
# (YES) or that it should be included in the master .chm file (NO).
# (YES) or that it should be included in the main .chm file (NO).
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
@@ -1299,7 +1451,8 @@ QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
# (see:
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1307,8 +1460,8 @@ QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
# folders).
# Folders (see:
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
@@ -1316,30 +1469,30 @@ QHP_VIRTUAL_FOLDER = doc
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
# filters).
# Filters (see:
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
# filters).
# Filters (see:
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_SECT_FILTER_ATTRS =
# The QHG_LOCATION tag can be used to specify the location of Qt's
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
# generated .qhp file.
# The QHG_LOCATION tag can be used to specify the location (absolute path
# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to
# run qhelpgenerator on the generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
QHG_LOCATION =
@@ -1416,6 +1569,17 @@ TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg
# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see
# https://inkscape.org) to generate formulas as SVG images instead of PNGs for
# the HTML output. These images will generally look nicer at scaled resolutions.
# Possible values are: png (the default) and svg (looks nicer but requires the
# pdf2svg or inkscape tool).
# The default value is: png.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FORMULA_FORMAT = png
# Use this tag to change the font size of LaTeX formulas included as images in
# the HTML documentation. When you change the font size after a successful
# doxygen run you need to manually remove any form_*.png images from the HTML
@@ -1425,7 +1589,7 @@ EXT_LINKS_IN_WINDOW = NO
FORMULA_FONTSIZE = 10
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# Use the FORMULA_TRANSPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are not
# supported properly for IE 6.0, but are supported on all modern browsers.
#
@@ -1436,8 +1600,14 @@ FORMULA_FONTSIZE = 10
FORMULA_TRANSPARENT = YES
# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands
# to create new LaTeX commands to be used in formulas as building blocks. See
# the section "Including formulas" for details.
FORMULA_MACROFILE =
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# http://www.mathjax.org) which uses client side Javascript for the rendering
# https://www.mathjax.org) which uses client side JavaScript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
@@ -1449,7 +1619,7 @@ USE_MATHJAX = NO
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
# http://docs.mathjax.org/en/latest/output.html) for more details.
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details.
# Possible values are: HTML-CSS (which is slower, but has the best
# compatibility), NativeMML (i.e. MathML) and SVG.
# The default value is: HTML-CSS.
@@ -1464,8 +1634,8 @@ MATHJAX_FORMAT = HTML-CSS
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from http://www.mathjax.org before deployment.
# The default value is: http://cdn.mathjax.org/mathjax/latest.
# MathJax from https://www.mathjax.org before deployment.
# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
@@ -1479,7 +1649,8 @@ MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
# (see:
# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
@@ -1507,7 +1678,7 @@ MATHJAX_CODEFILE =
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
# implemented using a web server instead of a web client using JavaScript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
@@ -1526,7 +1697,8 @@ SERVER_BASED_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/).
# Xapian (see:
# https://xapian.org/).
#
# See the section "External Indexing and Searching" for details.
# The default value is: NO.
@@ -1539,8 +1711,9 @@ EXTERNAL_SEARCH = NO
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/). See the section "External Indexing and
# Searching" for details.
# Xapian (see:
# https://xapian.org/). See the section "External Indexing and Searching" for
# details.
# This tag requires that the tag SEARCHENGINE is set to YES.
SEARCHENGINE_URL =
@@ -1591,21 +1764,35 @@ LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked.
#
# Note that when enabling USE_PDFLATEX this option is only used for generating
# bitmaps for formulas in the HTML output, but not in the Makefile that is
# written to the output directory.
# The default file is: latex.
# Note that when not enabling USE_PDFLATEX the default is latex when enabling
# USE_PDFLATEX the default is pdflatex and when in the later case latex is
# chosen this is overwritten by pdflatex. For specific output languages the
# default can have been set differently, this depends on the implementation of
# the output language.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
# index for LaTeX.
# Note: This tag is used in the Makefile / make.bat.
# See also: LATEX_MAKEINDEX_CMD for the part in the generated output file
# (.tex).
# The default file is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
MAKEINDEX_CMD_NAME = makeindex
# The LATEX_MAKEINDEX_CMD tag can be used to specify the command name to
# generate index for LaTeX. In case there is no backslash (\) as first character
# it will be automatically added in the LaTeX code.
# Note: This tag is used in the generated output file (.tex).
# See also: MAKEINDEX_CMD_NAME for the part in the Makefile / make.bat.
# The default value is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_MAKEINDEX_CMD = makeindex
# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
# documents. This may be useful for small projects and may help to save some
# trees in general.
@@ -1624,9 +1811,12 @@ COMPACT_LATEX = NO
PAPER_TYPE = a4
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
# that should be included in the LaTeX output. To get the times font for
# instance you can specify
# EXTRA_PACKAGES=times
# that should be included in the LaTeX output. The package can be specified just
# by its name or with the correct syntax as to be used with the LaTeX
# \usepackage command. To get the times font for instance you can specify :
# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
# To use the option intlimits with the amsmath package you can specify:
# EXTRA_PACKAGES=[intlimits]{amsmath}
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@@ -1687,9 +1877,11 @@ LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
# the PDF file directly from the LaTeX files. Set this option to YES, to get a
# higher quality PDF documentation.
# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as
# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX
# files. Set this option to YES, to get a higher quality PDF documentation.
#
# See also section LATEX_CMD_NAME for selecting the engine.
# The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES.
@@ -1723,12 +1915,28 @@ LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# https://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# The default value is: plain.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_BIB_STYLE = plain
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_TIMESTAMP = NO
# The LATEX_EMOJI_DIRECTORY tag is used to specify the (relative or absolute)
# path from which the emoji images will be read. If a relative path is entered,
# it will be relative to the LATEX_OUTPUT directory. If left blank the
# LATEX_OUTPUT directory will be used.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_EMOJI_DIRECTORY =
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
@@ -1768,9 +1976,9 @@ COMPACT_RTF = NO
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's config
# file, i.e. a series of assignments. You only have to provide replacements,
# missing definitions are set to their default value.
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# configuration file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
#
# See also section "Doxygen usage" for information on how to generate the
# default style sheet that doxygen normally uses.
@@ -1779,8 +1987,8 @@ RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
# similar to doxygen's config file. A template extensions file can be generated
# using doxygen -e rtf extensionFile.
# similar to doxygen's configuration file. A template extensions file can be
# generated using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_EXTENSIONS_FILE =
@@ -1866,6 +2074,13 @@ XML_OUTPUT = xml
XML_PROGRAMLISTING = YES
# If the XML_NS_MEMB_FILE_SCOPE tag is set to YES, doxygen will include
# namespace members in file scope as well, matching the HTML output.
# The default value is: NO.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_NS_MEMB_FILE_SCOPE = NO
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
@@ -1898,9 +2113,9 @@ DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
# AutoGen Definitions (see http://autogen.sf.net) file that captures the
# structure of the code including all documentation. Note that this feature is
# still experimental and incomplete at the moment.
# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures
# the structure of the code including all documentation. Note that this feature
# is still experimental and incomplete at the moment.
# The default value is: NO.
GENERATE_AUTOGEN_DEF = NO
@@ -1960,7 +2175,7 @@ ENABLE_PREPROCESSING = YES
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
MACRO_EXPANSION = NO
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
@@ -1968,7 +2183,7 @@ MACRO_EXPANSION = NO
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
EXPAND_ONLY_PREDEF = NO
EXPAND_ONLY_PREDEF = YES
# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
@@ -2000,7 +2215,15 @@ INCLUDE_FILE_PATTERNS =
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED =
PREDEFINED = "JERRY_STATIC_ASSERT(x,y)=" \
"JERRY_ATTR_FORMAT(x,y,z)=" \
"JERRY_ATTR_ALWAYS_INLINE=" \
"JERRY_ATTR_NOINLINE=" \
"JERRY_ATTR_PURE=" \
"JERRY_ATTR_CONST=" \
"JERRY_ATTR_HOT=" \
"JERRY_ATTR_NORETURN=" \
"JERRY_ATTR_WEAK="
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
@@ -2067,12 +2290,6 @@ EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
@@ -2086,15 +2303,6 @@ PERL_PATH = /usr/bin/perl
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
@@ -2192,10 +2400,32 @@ UML_LOOK = NO
# but if the number exceeds 15, the total amount of fields shown is limited to
# 10.
# Minimum value: 0, maximum value: 100, default value: 10.
# This tag requires that the tag HAVE_DOT is set to YES.
# This tag requires that the tag UML_LOOK is set to YES.
UML_LIMIT_NUM_FIELDS = 10
# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and
# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS
# tag is set to YES, doxygen will add type and arguments for attributes and
# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen
# will not generate fields with class member information in the UML graphs. The
# class diagrams will look similar to the default class diagrams but using UML
# notation for the relationships.
# Possible values are: NO, YES and NONE.
# The default value is: NO.
# This tag requires that the tag UML_LOOK is set to YES.
DOT_UML_DETAILS = NO
# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters
# to display on a single line. If the actual line length exceeds this threshold
# significantly it will wrapped across multiple lines. Some heuristics are apply
# to avoid ugly line breaks.
# Minimum value: 0, maximum value: 1000, default value: 17.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_WRAP_THRESHOLD = 17
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
# collaboration graphs will show the relations between templates and their
# instances.
@@ -2227,7 +2457,8 @@ INCLUDED_BY_GRAPH = YES
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected
# functions only using the \callgraph command.
# functions only using the \callgraph command. Disabling a call graph can be
# accomplished by means of the command \hidecallgraph.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
@@ -2238,7 +2469,8 @@ CALL_GRAPH = NO
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable caller graphs for selected
# functions only using the \callergraph command.
# functions only using the \callergraph command. Disabling a caller graph can be
# accomplished by means of the command \hidecallergraph.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
@@ -2261,13 +2493,17 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot.
# generated by dot. For an explanation of the image formats see the section
# output formats in the documentation of the dot tool (Graphviz (see:
# http://www.graphviz.org/)).
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
# to make the SVG files visible in IE 9+ (other browsers do not have this
# requirement).
# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
# gif:cairo:gd, gif:gd, gif:gd:gd and svg.
# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
# png:gdiplus:gdiplus.
# The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES.
@@ -2318,6 +2554,11 @@ DIAFILE_DIRS =
PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
@@ -2376,9 +2617,11 @@ DOT_MULTI_TARGETS = NO
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate
# files that are used to generate the various graphs.
#
# Note: This setting is not only used for dot files but also for msc and
# plantuml temporary files.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_CLEANUP = YES
+200 -10
View File
@@ -1,13 +1,203 @@
Copyright 2014-2016 Samsung Electronics Co., Ltd.
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
http://www.apache.org/licenses/LICENSE-2.0
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright JS Foundation and other contributors, http://js.foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+32 -12
View File
@@ -1,27 +1,30 @@
![](https://github.com/Samsung/jerryscript/blob/master/LOGO.png)
![](https://github.com/jerryscript-project/jerryscript/blob/master/LOGO.png)
# JerryScript: JavaScript engine for the Internet of Things
[![License](https://img.shields.io/badge/licence-Apache%202.0-brightgreen.svg?style=flat)](LICENSE)
[![Build Status](https://travis-ci.org/Samsung/jerryscript.svg?branch=master)](https://travis-ci.org/Samsung/jerryscript)
[![GitHub Actions Status](https://github.com/jerryscript-project/jerryscript/workflows/JerryScript%20CI/badge.svg)](https://github.com/jerryscript-project/jerryscript/actions)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjerryscript-project%2Fjerryscript.svg?type=shield)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjerryscript-project%2Fjerryscript?ref=badge_shield)
[![IRC Channel](https://img.shields.io/badge/chat-on%20freenode-brightgreen.svg)](https://kiwiirc.com/client/irc.freenode.net/#jerryscript)
JerryScript is a lightweight JavaScript engine for resource-constrained devices such as microcontrollers. It can run on devices with less than 64 KB of RAM and less than 200 KB of flash memory.
Key characteristics of JerryScript:
* Full ECMAScript 5.1 standard compliance
* 160K binary size when compiled for ARM Thumb-2
* ECMAScript 2025 standard compliance is 70%
* [Kangax Compatibilty Table](https://compat-table.github.io/compat-table/es2016plus/)
* 258K binary size when compiled for ARM Thumb-2
* Heavily optimized for low memory consumption
* Written in C99 for maximum portability
* Snapshot support for precompiling JavaScript source code to byte code
* Mature C API, easy to embed in applications
Additional information can be found on our [project page](http://samsung.github.io/jerryscript) and [Wiki](https://github.com/Samsung/jerryscript/wiki).
Additional information can be found on our [project page](http://jerryscript.net) and [Wiki](https://github.com/jerryscript-project/jerryscript/wiki).
IRC channel: #jerryscript on [freenode](https://freenode.net)
Mailing list: jerryscript-dev@gna.org, you can subscribe [here](https://mail.gna.org/listinfo/jerryscript-dev) and access the mailing list archive [here](https://mail.gna.org/public/jerryscript-dev).
Mailing list: jerryscript-dev@groups.io, you can subscribe [here](https://groups.io/g/jerryscript-dev) and access the mailing list archive [here](https://groups.io/g/jerryscript-dev/topics).
## Quick Start
### Getting the sources
```bash
git clone https://github.com/Samsung/jerryscript.git
git clone https://github.com/jerryscript-project/jerryscript.git
cd jerryscript
```
@@ -30,17 +33,34 @@ cd jerryscript
python tools/build.py
```
For additional information see [Getting Started](docs/01.GETTING-STARTED.md).
For additional information see [Getting Started](docs/00.GETTING-STARTED.md).
## Documentation
- [Getting Started](docs/01.GETTING-STARTED.md)
- [Getting Started](docs/00.GETTING-STARTED.md)
- [Configuration](docs/01.CONFIGURATION.md)
- [API Reference](docs/02.API-REFERENCE.md)
- [API Example](docs/03.API-EXAMPLE.md)
- [Internals](docs/04.INTERNALS.md)
- [Port API](docs/05.PORT-API.md)
- [Reference Couting](docs/06.REFERENCE-COUNTING.md)
- [Debugger](docs/07.DEBUGGER.md)
- [Coding Standards](docs/08.CODING-STANDARDS.md)
- [Arguments Extension API](docs/09.EXT-REFERENCE-ARG.md)
- [Property Extension API](docs/10.EXT-REFERENCE-HANDLER.md)
- [Autorelease Extension API](docs/11.EXT-REFERENCE-AUTORELEASE.md)
- [Module Extension API](docs/12.EXT-REFERENCE-MODULE.md)
- [Debugger Transport Interface](docs/13.DEBUGGER-TRANSPORT.md)
- [Scope Extension API](docs/14.EXT-REFERENCE-HANDLE-SCOPE.md)
- [Module System](docs/15.MODULE-SYSTEM.md)
- [Migration Guide](docs/16.MIGRATION-GUIDE.md)
## Contributing
The project can only accept contributions which are licensed under the [Apache License 2.0](LICENSE) and are signed according to the JerryScript [Developer's Certificate of Origin](DCO.md). For further information please see our [Contribution Guidelines](CONTRIBUTING.md).
## License
JerryScript is Open Source software under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). Complete license and copyright information can be found in the source code.
JerryScript is open source software under the [Apache License 2.0](LICENSE). Complete license and copyright information can be found in the source code.
> Copyright 2015 Samsung Electronics Co., Ltd.
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjerryscript-project%2Fjerryscript.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fjerryscript-project%2Fjerryscript?ref=badge_large)
> Copyright JS Foundation and other contributors, http://js.foundation
> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+29
View File
@@ -0,0 +1,29 @@
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(CMAKE_SYSTEM_NAME esp-idf)
set(CMAKE_SYSTEM_PROCESSOR xtensa)
set(CMAKE_C_COMPILER xtensa-esp32-elf-gcc)
set(CMAKE_CXX_COMPILER xtensa-esp32-elf-g++)
set(CMAKE_ASM_COMPILER xtensa-esp32-elf-gcc)
# uncomment that if you want 4-bytes float (much faster on esp32)
#add_definitions(-DJERRY_NUMBER_TYPE_FLOAT64=0)
set(CMAKE_C_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C Compiler Base Flags")
set(CMAKE_CXX_FLAGS "-mlongcalls -Wno-frame-address" CACHE STRING "C++ Compiler Base Flags")
# Can be removed after gcc 5.2.0 support is removed (ref GCC_NOT_5_2_0)
set(CMAKE_EXE_LINKER_FLAGS "-nostdlib" CACHE STRING "Linker Base Flags")
-20
View File
@@ -1,20 +0,0 @@
# Copyright 2015 Samsung Electronics Co., Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME EXTERNAL)
set(CMAKE_SYSTEM_PROCESSOR "${EXTERNAL_CMAKE_SYSTEM_PROCESSOR}")
CMAKE_FORCE_C_COMPILER(${EXTERNAL_CMAKE_C_COMPILER} ${EXTERNAL_CMAKE_C_COMPILER_ID})
+18
View File
@@ -0,0 +1,18 @@
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
+1 -1
View File
@@ -1,4 +1,4 @@
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
+1 -2
View File
@@ -1,5 +1,4 @@
# Copyright 2016 Samsung Electronics Co., Ltd.
# Copyright 2016 University of Szeged.
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
+3 -4
View File
@@ -1,4 +1,4 @@
# Copyright 2015 Samsung Electronics Co., Ltd.
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,12 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME MCU)
set(CMAKE_SYSTEM_PROCESSOR armv7l)
set(CMAKE_SYSTEM_VERSION STM32F3)
set(FLAGS_COMMON_ARCH -mlittle-endian -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard)
CMAKE_FORCE_C_COMPILER(arm-none-eabi-gcc GNU)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_C_COMPILER_WORKS TRUE)
+3 -4
View File
@@ -1,4 +1,4 @@
# Copyright 2015 Samsung Electronics Co., Ltd.
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -12,12 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME MCU)
set(CMAKE_SYSTEM_PROCESSOR armv7l)
set(CMAKE_SYSTEM_VERSION STM32F4)
set(FLAGS_COMMON_ARCH -mlittle-endian -mthumb -mcpu=cortex-m4 -march=armv7e-m -mfpu=fpv4-sp-d16 -mfloat-abi=hard)
CMAKE_FORCE_C_COMPILER(arm-none-eabi-gcc GNU)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_C_COMPILER_WORKS TRUE)
+22
View File
@@ -0,0 +1,22 @@
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(CMAKE_SYSTEM_NAME MCU)
set(CMAKE_SYSTEM_PROCESSOR armv7l)
set(CMAKE_SYSTEM_VERSION STM32F7)
set(FLAGS_COMMON_ARCH -mthumb -mcpu=cortex-m7 -march=armv7e-m -mfloat-abi=hard)
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
set(CMAKE_C_COMPILER_WORKS TRUE)
+33
View File
@@ -0,0 +1,33 @@
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
include(CMakeForceCompiler)
set(CMAKE_SYSTEM_NAME MCU)
set(CMAKE_SYSTEM_PROCESSOR armv7l)
set(CMAKE_SYSTEM_VERSION TIM4F)
set(FLAGS_COMMON_ARCH --little_endian --silicon_version=7M4 --float_support=FPv4SPD16)
CMAKE_FORCE_C_COMPILER(armcl TI)
SET (CMAKE_C_FLAGS_DEBUG_INIT "-g")
SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-o4 -mf0 -DNDEBUG")
SET (CMAKE_C_FLAGS_RELEASE_INIT "-o4 -DNDEBUG")
SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-o2 -g")
SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-o4 -mf0 -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-o4 -DNDEBUG")
SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-o2 -g")
+2 -2
View File
@@ -1,4 +1,4 @@
# Copyright 2016 Samsung Electronics Co., Ltd.
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -15,4 +15,4 @@
set(CMAKE_SYSTEM_NAME Openwrt)
set(CMAKE_SYSTEM_PROCESSOR mips)
set(CMAKE_C_COMPILER mipsel-openwrt-linux-gcc)
set(CMAKE_C_COMPILER mips-openwrt-linux-gcc)
+18
View File
@@ -0,0 +1,18 @@
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set(CMAKE_SYSTEM_NAME Openwrt)
set(CMAKE_SYSTEM_PROCESSOR mips)
set(CMAKE_C_COMPILER mipsel-openwrt-linux-gcc)
+186
View File
@@ -0,0 +1,186 @@
## Setting up prerequisites
Currently, only Ubuntu 18.04+ is officially supported as primary development environment.
There are several dependencies, that should be installed manually. The following list is the absolute minimum for building:
- `gcc` or any C99-compliant compiler (native or cross, e.g., arm-none-eabi)
- `cmake` >= `3.10`
Several scripts and tools help the building and development process, thus it is recommended to have the following installed as well:
- `bash` >= `4.3.11`
- `cppcheck` >= `2.7`
- `clang-format-15`
- `python` >= `3.10`
```bash
sudo apt-get install gcc gcc-arm-none-eabi cmake cppcheck clang-format-15 python
```
To make our scripts run correctly, several shell utilities should be available on the system:
- `awk`
- `bc`
- `find`
- `sed`
## Building JerryScript
**To build debug version for Linux**
```bash
python tools/build.py --debug
```
**To build debug version for Linux without LTO (Link Time Optimization)**
```bash
python tools/build.py --debug --lto=off
```
**To enable more verbose outputs for debugging**
```bash
tools/build.py --debug --logging=on --error-messages=on --line-info=on
```
**Add custom arguments to CMake**
```bash
python tools/build.py --cmake-param=CMAKE_PARAM
```
**Set a profile mode (es.next, minimal)**
```bash
python tools/build.py --profile=es.next|minimal
```
See also the related [README.md](../jerry-core/profiles/README.md).
**Use (compiler-default, external) libc**
The default libc is the compiler-default libc but you can use an external libc as well:
- compiler-default libc:
```bash
python tools/build.py
```
- external libc:
```bash
python tools/build.py --compile-flag="-nostdlib -I/path/to/ext-libc/include" --link-lib="ext-c"
```
**Add toolchain file**
The ```cmake``` dir already contains some usable toolchain files, which you can use in the following format:
```bash
python tools/build.py --toolchain=TOOLCHAIN
```
For example the cross-compile to RaspberryPi 2 is something like this:
```bash
python tools/build.py --toolchain=cmake/toolchain_linux_armv7l.cmake
```
**Use system memory allocator**
```bash
python tools/build.py --system-allocator=on
```
*Note*: System allocator is only supported on 32 bit systems.
**Enable 32bit compressed pointers**
```bash
python tools/build.py --cpointer-32bit=on
```
*Note*: There is no compression/decompression on 32 bit systems, if enabled.
**Change default heap size (512K)**
```bash
python tools/build.py --mem-heap=256
```
If you would like to use more than 512K, then you must enable the 32 bit compressed pointers.
```bash
python tools/build.py --cpointer-32bit=on --mem-heap=1024
```
*Note*: The heap size will be allocated statically at compile time, when JerryScript memory
allocator is used.
**To build with libfuzzer support**
```bash
CC=clang python tools/build.py --libfuzzer=on --compile-flag=-fsanitize=address --lto=off
```
Check the documentation of libfuzzer to get the runtime settings of the created fuzzer
binary: https://llvm.org/docs/LibFuzzer.html.
**To get a list of all the available buildoptions for Linux**
```bash
python tools/build.py --help
```
## Checking patch
```bash
python tools/run-tests.py --precommit
```
### Running only one type of test
**To run build option tests**
```bash
python tools/run-tests.py --buildoption-test
```
**To run unittests**
```bash
python tools/run-tests.py --unittests
```
**To run jerry-tests**
```bash
python tools/run-tests.py --jerry-tests
```
**To run signed-off check**
```bash
python tools/run-tests.py --check-signed-off
```
**To run cppcheck**
```bash
python tools/run-tests.py --check-cppcheck
```
**To run format check**
```bash
python tools/run-tests.py --check-format
```
**To get a list of all the available test options**
```bash
python tools/run-tests.py --help
```
+400
View File
@@ -0,0 +1,400 @@
# Configuration
JerryScript provides a large number of configuration options which can be used to enable or disable specific features, allowing users to fine tune the engine to best suit their needs.
A configuration option's value can be changed either by providing specific C preprocessor definitions, by adding CMake definitions, or by using the arguments of the `tools/build.py` script.
This document lists the available configuration options, shows the configuration name for C, CMake, and python, and provides a brief description that explains the effect of the options.
### Amalgamated build
Enables the amalgamated build process, which aggregates the contents of each source file per library
(i.e., JerryScript's core, port, and math libraries), and uses these combined files to compile the project.
This process can provide comparable results to link-time optimization, and can be useful when LTO is not available otherwise.
| Options | |
|---------|----------------------------------------------|
| C: | `<none>` |
| CMake: | `-DENABLE_AMALGAM=ON/OFF` |
| Python: | `--amalgam=ON/OFF` |
See also: [Amalgamated sources](#amalgamated-sources)
### Jerry debugger
Enables debugger support in the engine, which can be used to debug running JavaScript code. For more information on using the debugger see [Debugger](07.DEBUGGER.md).
The debugger is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_DEBUGGER=0/1` |
| CMake: | `-DJERRY_DEBUGGER=ON/OFF` |
| Python: | `--jerry-debugger=ON/OFF` |
### Line information
By default, all source code information is discarded after parsing is complete. This option can be used to augment the created bytecode to provide line information during runtime,
that can be used by the debugger to identify the currently executed source context. See [Debugger](07.DEBUGGER.md).
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_LINE_INFO=0/1` |
| CMake: | `-DJERRY_LINE_INFO=ON/OFF` |
| Python: | `--line-info=ON/OFF` |
### Profiles
This option can be used to enable/disable available JavaScript language features by providing profile files. Profile files contain a list of C definitions that configure each individual feature.
The `path` value for CMake and Python arguments should be a file path to the profile file, or one of `es.next` or `minimal`, which are the pre-defined profiles.
To see how a profile file should be created, or what configuration options are available in C, see the profile [README](https://github.com/jerryscript-project/jerryscript/blob/master/jerry-core/profiles/README.md).
| Options | |
|---------|----------------------------------------------|
| C: | `<see description>` |
| CMake: | `-DJERRY_PROFILE="path"` |
| Python: | `--profile="path"` |
### Promise callback
Enables Promise event notification support. This feature allows setting a user callback, which is called when certain Promise related events occur such as
creating a new Promise, resolving a Promise with a value, etc.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_PROMISE_CALLBACK=0/1` |
| CMake: | `-DJERRY_PROMISE_CALLBACK=ON/OFF` |
| Python: | `--promise-callback=ON/OFF` |
### External context
Enables external context support in the engine. By default, JerryScript uses a statically allocated context to store the current state of the engine internals.
When this option is enabled, an externally allocated memory region can be provided through the port API to the engine, to be used as the context.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_EXTERNAL_CONTEXT=0/1` |
| CMake: | `-DJERRY_EXTERNAL_CONTEXT=ON/OFF` |
| Python: | `--external-context=ON/OFF` |
### Snapshot execution
This option can be used to enable snapshot execution in the engine.
This option is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_SNAPSHOT_EXEC=0/1` |
| CMake: | `-DJERRY_SNAPSHOT_EXEC=ON/OFF` |
| Python: | `--snapshot-exec=ON/OFF` |
### Snapshot saving
This option can be used to enable snapshot saving in the engine.
This option is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_SNAPSHOT_SAVE=0/1` |
| CMake: | `-DJERRY_SNAPSHOT_SAVE=ON/OFF` |
| Python: | `--snapshot-save=ON/OFF` |
### Jerry parser
This option can be used to enable or disable the parser. When the parser is disabled all features that depend on source parsing are unavailable (eg. `jerry_parse`, `eval`, Function constructor).
This option can be useful in combination with the snapshot feature. The parser is enabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_PARSER=0/1` |
| CMake: | `-DJERRY_PARSER=ON/OFF` |
| Python: | `--js-parser=ON/OFF` |
### Dump bytecode
This option can be used to display created bytecode in a human readable format. See [Internals](04.INTERNALS.md#byte-code) for more details.
This option is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_PARSER_DUMP_BYTE_CODE=0/1` |
| CMake: | `-DJERRY_PARSER_DUMP_BYTE_CODE=ON/OFF` |
| Python: | `--show-opcodes=ON/OFF` |
### Dump RegExp bytecode
This option can be used to display created RegExp bytecode in a human readable format. The RegExp bytecode is different from the bytecode used by the virtual machine.
This option is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_REGEXP_DUMP_BYTE_CODE=0/1` |
| CMake: | `-DJERRY_REGEXP_DUMP_BYTE_CODE=ON/OFF` |
| Python: | `--show-regexp-opcodes=ON/OFF` |
### Strict RegExp
This option can be used to enable strict RegExp mode. The standard RegExp syntax is a lot stricter than what is common in current JavaScript implementations.
When enabled, this flag disables all of the non-standard, quality-of-life RegExp features, that are implemented to provide compatibility with other commonly used engines.
This option is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_REGEXP_STRICT_MODE=0/1` |
| CMake: | `-DJERRY_REGEXP_STRICT_MODE=ON/OFF` |
| Python: | `--regexp-strict-mode=ON/OFF` |
### Error messages
Enables error messages for thrown Error objects. By default, error messages are omitted to reduce memory usage.
Enabling this feature provides detailed error messages where available, like line information for Syntax errors, variable names for Reference errors, Type/Range error messages for built-in routines, etc.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_ERROR_MESSAGES=0/1` |
| CMake: | `-DJERRY_ERROR_MESSAGES=ON/OFF` |
| Python: | `--error-messages=ON/OFF` |
### Logging
This option can be used to enable log messages during runtime. When enabled the engine will use the `jerry_port_log` port API function to print relevant log messages.
This feature is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_LOGGING=0/1` |
| CMake: | `-DJERRY_LOGGING=ON/OFF` |
| Python: | `--logging=ON/OFF` |
### LCache
This option enables the LCache, allowing faster access to object properties. The LCache uses a statically allocated hash-map, which increases memory consumption.
See [Internals](04.INTERNALS.md#lcache) for further details.
This option is enabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_LCACHE=0/1` |
| CMake: | `<none>` |
| Python: | `<none>` |
### Property hashmaps
This option enables the creation of hashmaps for object properties, which allows faster property access, at the cost of increased memory consumption.
See [Internals](04.INTERNALS.md#property-hashmap) for further details.
This option is enabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_PROPERTY_HASHMAP=0/1` |
| CMake: | `<none>` |
| Python: | `<none>` |
### Memory statistics
This option can be used to provide memory usage statistics either upon engine termination, or during runtime using the `jerry_heap_stats` jerry API function.
The feature can create a significant performance overhead, and should only be used for measurement purposes. This option is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_MEM_STATS=0/1` |
| CMake: | `-DJERRY_MEM_STATS=ON/OFF` |
| Python: | `--mem-stats=ON/OFF` |
### Heap size
This option can be used to adjust the size of the internal heap, represented in kilobytes. The provided value should be an integer. Values larger than 512 require 32-bit compressed pointers to be enabled.
The default value is 512.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_GLOBAL_HEAP_SIZE=(int)` |
| CMake: | `-DJERRY_GLOBAL_HEAP_SIZE=(int)` |
| Python: | `--mem-heap=(int)` |
### Garbage collection limit
This option can be used to adjust the maximum allowed heap usage increase until triggering the next garbage collection, in bytes.
When the total allocated memory size reaches the current gc limit, garbage collection will be triggered to try and reduce clutter from unreachable objects.
If the total allocated memory can't be reduced below the current limit, then the limit will be increased by the amount specified via this option.
Similarly, when the total allocated memory goes well below the current gc limit, the limit is reduced by this amount.
The default value is 1/32 of the total heap size, but not greater than 8192 bytes.
A value of 0 will use the default value.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_GC_LIMIT=(int)` |
| CMake: | `-DJERRY_GC_LIMIT=(int)` |
| Python: | `--gc-limit=(int)` |
### GC mark recursion limit
This option can be used to adjust the maximum recursion depth during the GC mark phase. The provided value should be an integer, which represents the allowed number of recursive calls. Increasing the depth of the recursion reduces the time of GC cycles, however increases stack usage.
A value of 0 will prevent any recursive GC calls.
| Options | |
|---------|---------------------------------------------------|
| C: | `-DJERRY_GC_MARK_LIMIT=(int)` |
| CMake: | `-DJERRY_GC_MARK_LIMIT=(int)` |
| Python: | `--gc-mark-limit=(int)` |
### Stack limit
This option can be used to cap the stack usage of the engine, and prevent stack overflows due to recursion. The provided value should be an integer, which represents the allowed stack usage in kilobytes.
The default value is 0 (unlimited).
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_STACK_LIMIT=(int)` |
| CMake: | `-DJERRY_STACK_LIMIT=(int)` |
| Python: | `--stack-limit=(int)` |
### 32-bit compressed pointers
Enables 32-bit pointers instead of the default 16-bit compressed pointers. This allows the engine to use a much larger heap, but also comes with slightly increased memory usage, as objects can't be packed as tightly.
This option must be enabled when using the system allocator.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_CPOINTER_32_BIT=0/1` |
| CMake: | `-DJERRY_CPOINTER_32_BIT=ON/OFF` |
| Python: | `--cpointer-32bit=ON/OFF` |
### System allocator
This option enables the use of malloc/free instead of the internal JerryScript allocator. This feature requires 32-bit compressed pointers, and is unsupported on 64-bit architectures.
This option is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_SYSTEM_ALLOCATOR=0/1` |
| CMake: | `-DJERRY_SYSTEM_ALLOCATOR=ON/OFF` |
| Python: | `--system-allocator=ON/OFF` |
### Valgrind support
This option enables valgrind support for the internal allocator. When enabled, valgrind will be able to properly identify allocated memory regions, and report leaks or out-of-bounds memory accesses.
This option is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_VALGRIND=0/1` |
| CMake: | `-DJERRY_VALGRIND=ON/OFF` |
| Python: | `--valgrind=ON/OFF` |
### Memory stress test
This option can be used to stress test memory management, by running garbage collection before every allocation attempt.
This option is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_MEM_GC_BEFORE_EACH_ALLOC=0/1` |
| CMake: | `-DJERRY_MEM_GC_BEFORE_EACH_ALLOC=ON/OFF` |
| Python: | `--mem-stress-test=ON/OFF` |
### MSVC CRT
This option enables the use of the MSVC CRT library and is disabled by default.
| Options | |
|---------|----------------------------------------------|
| C: | `<none>` |
| CMake: | `-DENABLE_STATIC_CRT=ON/OFF` |
| Python: | `--static-crt=ON/OFF` |
### Architecture
Specify the platform name if it is supported by the generator.
| Options | |
|---------|----------------------------------------------|
| C: | `<none>` |
| CMake: | `-A (string)` |
| Python: | `--arch=(string)` |
### Tostring function
Enable function toString.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_FUNCTION_TO_STRING=0/1` |
| CMake: | `-DJERRY_FUNCTION_TO_STRING=ON/OFF` |
| Python: | `--function-to-string=ON/OFF` |
### VM throw
Enable VM throw.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_VM_THROW=0/1` |
| CMake: | `-DJERRY_VM_THROW=ON/OFF` |
| Python: | `--vm-throw=ON/OFF` |
### Promise callback
Enable Promise callback.
| Options | |
|---------|----------------------------------------------|
| C: | `-DJERRY_PROMISE_CALLBACK=0/1` |
| CMake: | `-DJERRY_PROMISE_CALLBACK=ON/OFF` |
| Python: | `--promise-callback=ON/OFF` |
# Amalgamated sources
The sources of JerryScript can be combined into a handful of files to allow their easy integration
in other projects. To achieve this, the following command can be executed to create a set of files
into the `amalgam` directory:
```sh
$ python tools/amalgam.py --output-dir amalgam --jerry-core --jerry-port --jerry-math
```
(Note: In the example above, the command is executed from the project's root directory, but that is
not mandatory.)
The command creates the following files in the `amalgam` dir:
* `jerryscript.c`
* `jerryscript.h`
* `jerryscript-config.h`
* `jerryscript-port.c`
* `jerryscript-math.c`
* `math.h`
**Important**: the `jerryscript-config.h` contains the configurations mentioned above and
should be adapted to the required use-case. See the file contents for more details and for the
default configuration. (Note: This config file is created from the the `jerry-core/config.h` file.)
These files can be directly compiled with an application using the JerryScript API.
E.g., using a command similar to the one below:
```sh
$ gcc -Wall -o demo_app demo_app.c amalgam/jerryscript.c amalgam/jerryscript-port.c amalgam/jerryscript-math.c -Iamalgam/
```
(Note: The headers must be available on the include path.)
This approach is also under the hood of the [amalgamated build](#amalgamated-build) process.
# Target specific information
## x86 with GCC
When building for Intel 32 bit architecture it is possible that GCC uses conservative options, thus assuming the most
basic floating-point support (that is it does not generate SSE or others instructions).
However this could lead to loss off precision and/or different results than what is required by the JavaScript standard
in regards of floating-point values and arithmetic.
To resolve this precision problem it is advised to use at least SSE2.
To do this with GCC please provide the `-mfpmath=sse -msse2` options during build.
These options can also be specified via the `build.py` script:
```sh
$ ./tools/build.py --compile-flag=-mfpmath=sse --compile-flag=-msse2 --compile-flag=-m32
```
-143
View File
@@ -1,143 +0,0 @@
## Setting up prerequisites
Currently, only Ubuntu 14.04+ is officially supported as primary development environment.
There are several dependencies, that should be installed manually. The following list is required for building:
- `gcc` or any C99-compliant compiler
- native
- arm-none-eabi
- `cmake` >= `2.8.12.2`
- `bash` >= `4.3.11`
- `cppcheck` >= `1.61`
- `vera++` >= `1.2.1`
- `python` >= `2.7.6`
```bash
sudo apt-get install gcc g++ gcc-arm-none-eabi cmake cppcheck vera++ python
```
To make our scripts run correctly, several shell utilities should be available on the system:
- `awk`
- `bc`
- `find`
- `sed`
## Building JerryScript
**To build debug version for Linux**
```bash
python tools/build.py --debug
```
**To build debug version for Linux without LTO (Link Time Optimization)**
```bash
python tools/build.py --debug --lto=off
```
**Add custom arguments to CMake**
```bash
python tools/build.py --cmake-param=CMAKE_PARAM
```
**Set a profile mode (full, minimal)**
```bash
python tools/build.py --feature=full|minimal
```
**Use (jerry, compiler-default, external) libc**
The default libc is jerry-libc, but you can use compiler-default libc or an external libc:
- compiler-default libc:
```bash
python tools/build.py --jerry-libc=off --compiler-default-libc=on
```
- external libc:
```bash
python tools/build.py --jerry-libc=off --compiler-default-libc=off --compile-flag="-I/path/to/libc/include"
```
**Add toolchain file**
The ```cmake``` dir already contains some usable toolchain files, which you can use in the following format:
```bash
python tools/build.py --toolchain=TOOLCHAIN
```
For example the cross-compile to RaspberryPi 2 is something like this:
```bash
python tools/build.py --toolchain=cmake/toolchain_linux_armv7l.cmake
```
**To get a list of all the available buildoptions for Linux**
```bash
python tools/build.py --help
```
## Checking patch
```bash
python tools/run-tests.py --precommit
```
### Running only one type of test
**To run build option tests**
```bash
python tools/run-tests.py --buildoption-test
```
**To run unittests**
```bash
python tools/run-tests.py --unittests
```
**To run jerry-tests**
```bash
python tools/run-tests.py --jerry-tests
```
**To run jerry-test-suite**
```bash
python tools/run-tests.py --jerry-test-suite
```
**To run signed-off check**
```bash
python tools/run-tests.py --check-signed-off
```
**To run cppcheck**
```bash
python tools/run-tests.py --check-cppcheck
```
**To run vera check**
```bash
python tools/run-tests.py --check-vera
```
**To get a list of all the available test options**
```bash
python tools/run-tests.py --help
```
+11577 -880
View File
File diff suppressed because it is too large Load Diff
+730 -167
View File
File diff suppressed because it is too large Load Diff
+30 -27
View File
@@ -23,7 +23,7 @@ Expression parser is responsible for parsing JavaScript expressions. It is imple
JavaScript statements are parsed by this component. It uses the [Expression parser](#expression-parser) to parse the constituent expressions. The implementation of Statement parser is located in `./jerry-core/parser/js/js-parser-statm.c`.
Function `parser_parse_source` carries out the parsing and compiling of the input EcmaScript source code. When a function appears in the source `parser_parse_source` calls `parser_parse_function` which is responsible for processing the source code of functions recursively including argument parsing and context handling. After the parsing, function `parser_post_processing` dumps the created opcodes and returns an `ecma_compiled_code_t*` that points to the compiled bytecode sequence.
Function `parser_parse_source` carries out the parsing and compiling of the input ECMAScript source code. When a function appears in the source `parser_parse_source` calls `parser_parse_function` which is responsible for processing the source code of functions recursively including argument parsing and context handling. After the parsing, function `parser_post_processing` dumps the created opcodes and returns an `ecma_compiled_code_t*` that points to the compiled bytecode sequence.
The interactions between the major components shown on the following figure.
@@ -31,21 +31,21 @@ The interactions between the major components shown on the following figure.
# Byte-code
This section describes the compact byte-code (CBC) byte-code representation. The key focus is reducing memory consumption of the byte-code representation without sacrificing considerable performance. Other byte-code representations often focus on performance only so inventing this representation is an original research.
This section describes the compact byte-code (CBC) representation. The key focus is reducing memory consumption of the byte-code representation without sacrificing considerable performance. Other byte-code representations often focus on performance only so inventing this representation is an original research.
CBC is a CISC like instruction set which assigns shorter instructions for frequent operations. Many instructions represent multiple atomic tasks which reduces the byte code size. This technique is basically a data compression method.
CBC is a CISC like instruction set which assigns shorter instructions for frequent operations. Many instructions represent multiple atomic tasks which reduces the bytecode size. This technique is basically a data compression method.
## Compiled Code Format
The memory layout of the compiled byte code is the following.
The memory layout of the compiled bytecode is the following.
![CBC layout](img/CBC_layout.png)
The header is a `cbc_compiled_code` structure with several fields. These fields contain the key properties of the compiled code.
The literals part is an array of ecma values. These values can contain any EcmaScript value types, e.g. strings, numbers, function and regexp templates. The number of literals is stored in the `literal_end` field of the header.
The literals part is an array of ecma values. These values can contain any ECMAScript value types, e.g. strings, numbers, functions and regexp templates. The number of literals is stored in the `literal_end` field of the header.
CBC instruction list is a sequence of byte code instructions which represents the compiled code.
CBC instruction list is a sequence of bytecode instructions which represents the compiled code.
## Byte-code Format
@@ -55,7 +55,7 @@ The memory layout of a byte-code is the following:
Each byte-code starts with an opcode. The opcode is one byte long for frequent and two byte long for rare instructions. The first byte of the rare instructions is always zero (`CBC_EXT_OPCODE`), and the second byte represents the extended opcode. The name of common and rare instructions start with `CBC_` and `CBC_EXT_` prefix respectively.
The maximum number of opcodes is 511, since 255 common (zero value excluded) and 256 rare instructions can be defined. Currently around 230 frequent and 120 rare instructions are available.
The maximum number of opcodes is 511, since 255 common (zero value excluded) and 256 rare instructions can be defined. Currently around 215 frequent and 70 rare instructions are available.
There are three types of bytecode arguments in CBC:
@@ -63,7 +63,7 @@ There are three types of bytecode arguments in CBC:
* __literal argument__: An integer index which is greater or equal than zero and less than the `literal_end` field of the header. For further information see next section Literals (next).
* __relative branch__: An 1-3 byte long offset. The branch argument might also represent the end of an instruction range. For example the branch argument of `CBC_EXT_WITH_CREATE_CONTEXT` shows the end of a `with` statement. More precisely the position after the last instruction.
* __relative branch__: An 1-3 byte long offset. The branch argument might also represent the end of an instruction range. For example the branch argument of `CBC_EXT_WITH_CREATE_CONTEXT` shows the end of a `with` statement. More precisely the position after the last instruction in the with clause.
Argument combinations are limited to the following seven forms:
@@ -78,7 +78,7 @@ Argument combinations are limited to the following seven forms:
## Literals
Literals are organized into groups whose represent various literal types. Having these groups consuming less space than assigning flag bits to each literal.
(In the followings, the mentioned ranges represent those indicies which are greater than or equal to the left side and less than the right side of the range. For example a range between `ident_end` and `literal_end` fields of the byte-code header contains those indicies, which are greater than or equal to `ident_end`
(In the followings, the mentioned ranges represent those indices which are greater than or equal to the left side and less than the right side of the range. For example a range between `ident_end` and `literal_end` fields of the byte-code header contains those indices, which are greater than or equal to `ident_end`
and less than `literal_end`. If `ident_end` equals to `literal_end` the range is empty.)
The two major group of literals are _identifiers_ and _values_.
@@ -137,12 +137,12 @@ Byte-codes of this category serve for placing objects onto the stack. As there a
<span class="CSSTableGenerator" markdown="block">
| byte-code | description |
| --------------------- | ---------------------------------------------------- |
| CBC_PUSH_LITERAL | Pushes the value of the given literal argument. |
| CBC_PUSH_TWO_LITERALS | Pushes the value of the given two literal arguments. |
| CBC_PUSH_UNDEFINED | Pushes an undefined value. |
| CBC_PUSH_TRUE | Pushes a logical true. |
| byte-code | description |
| --------------------- | ----------------------------------------------------- |
| CBC_PUSH_LITERAL | Pushes the value of the given literal argument. |
| CBC_PUSH_TWO_LITERALS | Pushes the values of the given two literal arguments. |
| CBC_PUSH_UNDEFINED | Pushes an undefined value. |
| CBC_PUSH_TRUE | Pushes a logical true. |
| CBC_PUSH_PROP_LITERAL | Pushes a property whose base object is popped from the stack, and the property name is passed as a literal argument. |
</span>
@@ -196,7 +196,7 @@ Branch byte-codes are used to perform conditional and unconditional jumps in the
| CBC_JUMP_BACKWARD | Jumps backward by the 1 byte long relative offset argument. |
| CBC_JUMP_BACKWARD_2 | Jumps backward by the 2 byte long relative offset argument. |
| CBC_JUMP_BACKWARD_3 | Jumps backward by the 3 byte long relative offset argument. |
| CBC_BRANCH_IF_TRUE_FORWARD | Jumps if the value on the top of the stack is true by the 1 byte long relative offset argument. |
| CBC_BRANCH_IF_TRUE_FORWARD | Jumps forward if the value on the top of the stack is true by the 1 byte long relative offset argument. |
</span>
@@ -219,12 +219,14 @@ ECMA component of the engine is responsible for the following notions:
## Data Representation
The major structure for data representation is `ECMA_value`. The lower two bits of this structure encode value tag, which determines the type of the value:
The major structure for data representation is `ECMA_value`. The lower three bits of this structure encode value tag, which determines the type of the value:
* simple
* number
* string
* object
* symbol
* error
![ECMA value representation](img/ecma_value.png)
@@ -243,16 +245,17 @@ Compressed pointers were introduced to save heap space.
![Compressed Pointer](img/ecma_compressed.png)
These pointers are 8 byte aligned 16 bit long pointers which can address 512 Kb of memory which is also the maximum size of the JerryScript heap.
ECMA data elements are allocated in pools (pools are allocated on heap)
Chunk size of the pool is 8 bytes (reduces fragmentation).
These pointers are 8 byte aligned 16 bit long pointers which can address 512 Kb of
memory which is also the maximum size of the JerryScript heap. To support even more
memory the size of compressed pointers can be extended to 32 bit to cover the entire
address space of a 32 bit system by passing "--cpointer_32_bit on" to the build
system. These "uncompressed pointers" increases the memory consumption by around 20%.
### Number
There are two possible representation of numbers according to standard IEEE 754:
The default is 8-byte (double),
but the engine supports the 4-byte (single precision) representation by setting CONFIG_ECMA_NUMBER_TYPE as well.
but the engine supports the 4-byte (single precision) representation by setting JERRY_NUMBER_TYPE_FLOAT64 to 0 as well.
![Number](img/number.png)
@@ -260,7 +263,7 @@ Several references to single allocated number are not supported. Each reference
### String
Strings in JerryScript are not just character sequences, but can hold numbers and so-called magic ids too. For common character sequences there is a table in the read only memory that contains magic id and character sequence pairs. If a string is already in this table, the magic id of its string is stored, not the character sequence itself. Using numbers speeds up the property access. These techniques save memory.
Strings in JerryScript are not just character sequences, but can hold numbers and so-called magic ids too. For common character sequences (defined in `./jerry-core/lit/lit-magic-strings.ini`) there is a table in the read only memory that contains magic id and character sequence pairs. If a string is already in this table, the magic id of its string is stored, not the character sequence itself. Using numbers speeds up the property access. These techniques save memory.
### Object / Lexical Environment
@@ -268,13 +271,12 @@ An object can be a conventional data object or a lexical environment object. Unl
[Lexical environments](http://www.ecma-international.org/ecma-262/5.1/#sec-10.2) are implemented as objects in JerryScript, since lexical environments contains key-value pairs (called bindings) like objects. This simplifies the implementation and reduces code size.
![Object/Lexicat environment structures](img/ecma_object.png)
![Object/Lexical environment structures](img/ecma_object.png)
The objects are represented as following structure:
* Reference counter - number of hard (non-property) references
* Next object pointer for the garbage collector
* GC's visited flag
* type (function object, lexical environment, etc.)
### Properties of Objects
@@ -282,7 +284,8 @@ The objects are represented as following structure:
![Object properties](img/ecma_object_property.png)
Objects have a linked list that contains their properties. This list actually contains property pairs, in order to save memory described in the followings:
A property is 7 bit long and its type field is 2 bit long which consumes 9 bit which does not fit into 1 byte but consumes 2 bytes. Hence, placing together two properties (14 bit) with the 2 bit long type field fits into 2 bytes.
A property has a one byte long descriptor, a two byte long name and four byte long value. Hence 14 bytes consumed by a property pair. Another two bytes is
used to show the next property pair, so the total size (16 byte) is divisible by 8.
#### Property Hashmap
@@ -322,7 +325,7 @@ Collections are array-like data structures, which are optimized to save memory.
### Exception Handling
In order to implement a sense of exception handling, the return values of JerryScript functions are able to indicate their faulty or "exceptional" operation. The return values are actually ECMA values (see section [Data Representation](#data-representation)) in which the error bit is set if an erroneous operation is occurred.
In order to implement a sense of exception handling, the return values of JerryScript functions are able to indicate their faulty or "exceptional" operation. The return values are ECMA values (see section [Data Representation](#data-representation)) and if an erroneous operation occurred the ECMA_VALUE_ERROR simple value is returned.
### Value Management and Ownership
+278
View File
@@ -0,0 +1,278 @@
# Reference
## Process management
It is questionable whether a library should be able to terminate an application. Any API function can signal an error (ex.: cannot allocate memory), so the engine use the termination approach with this port function.
```c
/**
* Init the program
*/
void jerry_port_init (void);
```
```c
/**
* Signal the port that jerry experienced a fatal failure from which it cannot
* recover.
*
* @param code gives the cause of the error.
*
* Note:
* Jerry expects the function not to return.
*
* Example: a libc-based port may implement this with exit() or abort(), or both.
*/
void jerry_port_fatal (jerry_fatal_code_t code);
```
Error codes
```c
typedef enum
{
JERRY_FATAL_OUT_OF_MEMORY = 10,
JERRY_FATAL_REF_COUNT_LIMIT = 12,
JERRY_FATAL_DISABLED_BYTE_CODE = 13,
JERRY_FATAL_UNTERMINATED_GC_LOOPS = 14,
JERRY_FATAL_FAILED_ASSERTION = 120
} jerry_fatal_code_t;
```
```c
/**
* Makes the process sleep for a given time.
*
* Note:
* This port function is called by jerry-core when JERRY_DEBUGGER is set to 1.
* Otherwise this function is not used.
*
* @param sleep_time milliseconds to sleep.
*/
void jerry_port_sleep (uint32_t sleep_time);
```
## External context
Allows the user to provide external buffer for isolated engine contexts, so that user
can configure the heap size at runtime and run multiple JS applications
simultaneously.
```c
/**
* Allocate a new context for the engine.
*
* This port function is called by jerry_init when JERRY_EXTERNAL_CONTEXT is enabled. Otherwise this function is not
* used. The engine will pass the size required for the context structure. An implementation must make sure to
* allocate at least this amount.
*
* Excess allocated space will be used as the engine heap when jerryscript is configured to use it's internal allocator,
* this can be used to control the internal heap size.
*
* NOTE: The allocated memory must be pointer-aligned, otherwise the behavior is
* undefined.
*
* @param context_size: the size of the internal context structure
*
* @return total size of the allocated buffer
*/
size_t jerry_port_context_alloc (size_t context_size);
```
```c
/**
* Get the currently active context of the engine.
*
* This port function is called by jerry-core when JERRY_EXTERNAL_CONTEXT is enabled.
* Otherwise this function is not used.
*
* @return the pointer to the currently used engine context.
*/
struct jerry_context_t *jerry_port_context_get (void);
```
```c
/**
* Free the currently used context.
*
* This port function is called by jerry_cleanup when JERRY_EXTERNAL_CONTEXT is enabled.
* Otherwise this function is not used.
*
* @return the pointer to the engine context.
*/
void jerry_port_context_free (void);
```
## I/O
```c
/**
* Display or log a debug/error message.
*
* The message is passed as a zero-terminated string. Messages may be logged in parts, which
* will result in multiple calls to this functions. The implementation should consider
* this before appending or prepending strings to the argument.
*
* This function is called with messages coming from the jerry engine as
* the result of some abnormal operation or describing its internal operations
* (e.g., data structure dumps or tracing info).
*
* The implementation can decide whether error and debug messages are logged to
* the console, or saved to a database or to a file.
*
* @param message_p: the message to log.
*/
void jerry_port_log (const char *message_p);
```
```c
/**
* Print a buffer to standard output
*
* This port function is never called from jerry-core directly, it is only used by jerry-ext components to print
* information.
*
* @param buffer_p: input buffer
* @param buffer_size: data size
*/
void jerry_port_print_buffer (const jerry_char_t *buffer_p, jerry_size_t buffer_size);
```
```c
/**
* Read a line from standard input.
*
* The implementation should allocate storage necessary for the string. The result string should include the ending line
* terminator character(s) and should be zero terminated.
*
* An implementation may return NULL to signal that the end of input is reached, or an error occured.
*
* When a non-NULL value is returned, the caller will pass the returned value to `jerry_port_line_free` when the line is
* no longer needed. This can be used to finalize dynamically allocated buffers if necessary.
*
* This port function is never called from jerry-core directly, it is only used by some jerry-ext components that
* require user input.
*
* @param out_size_p: size of the input string in bytes, excluding terminating zero byte
*
* @return pointer to the buffer storing the string,
* or NULL if end of input
*/
jerry_char_t *jerry_port_line_read (jerry_size_t *out_size_p);
```
```c
/**
* Free a line buffer allocated by jerry_port_line_read
*
* @param buffer_p: buffer returned by jerry_port_line_read
*/
void jerry_port_line_free (jerry_char_t *buffer_p);
```
## Filesystem
```
/**
* Canonicalize a file path.
*
* If possible, the implementation should resolve symbolic links and other directory references found in the input path,
* and create a fully canonicalized file path as the result.
*
* The function may return with NULL in case an error is encountered, in which case the calling operation will not
* proceed.
*
* The implementation should allocate storage for the result path as necessary. Non-NULL return values will be passed
* to `jerry_port_path_free` when the result is no longer needed by the caller, which can be used to finalize
* dynamically allocated buffers.
*
* NOTE: The implementation must not return directly with the input, as the input buffer is released after the call.
*
* @param path_p: zero-terminated string containing the input path
* @param path_size: size of the input path string in bytes, excluding terminating zero
*
* @return buffer with the normalized path if the operation is successful,
* NULL otherwise
*/
jerry_char_t *jerry_port_path_normalize (const jerry_char_t *path_p, jerry_size_t path_size);
```
```c
/**
* Free a path buffer returned by jerry_port_path_normalize.
*
* @param path_p: the path buffer to free
*/
void jerry_port_path_free (jerry_char_t *path_p);
```
```c
/**
* Get the offset of the basename component in the input path.
*
* The implementation should return the offset of the first character after the last path separator found in the path.
* This is used by the caller to split the path into a directory name and a file name.
*
* @param path_p: input zero-terminated path string
*
* @return offset of the basename component in the input path
*/
jerry_size_t jerry_port_path_base (const jerry_char_t *path_p);
```
```c
/**
* Open a source file and read its contents into a buffer.
*
* When the source file is no longer needed by the caller, the returned pointer will be passed to
* `jerry_port_source_free`, which can be used to finalize the buffer.
*
* @param file_name_p: Path that points to the source file in the filesystem.
* @param out_size_p: The opened file's size in bytes.
*
* @return pointer to the buffer which contains the content of the file.
*/
jerry_char_t *jerry_port_source_read (const char *file_name_p, jerry_size_t *out_size_p);
```
```c
/**
* Free a source file buffer.
*
* @param buffer_p: buffer returned by jerry_port_source_read
*/
void jerry_port_source_free (jerry_char_t *buffer_p);
```
## Date
```c
/**
* Get local time zone adjustment in milliseconds for the given input time.
*
* The argument is a time value representing milliseconds since unix epoch.
*
* Ideally, this function should satisfy the stipulations applied to LocalTZA
* in section 21.4.1.7 of the ECMAScript version 12.0, as if called with isUTC true.
*
* This port function can be called by jerry-core when JERRY_BUILTIN_DATE is enabled.
* Otherwise this function is not used.
*
* @param unix_ms: time value in milliseconds since unix epoch
*
* @return local time offset in milliseconds applied to UTC for the given time value
*/
int32_t jerry_port_local_tza (double unix_ms);
```
```c
/**
* Get the current system time in UTC.
*
* This port function is called by jerry-core when JERRY_BUILTIN_DATE is enabled.
* It can also be used in the implementing application to initialize the random number generator.
*
* @return milliseconds since Unix epoch
*/
double jerry_port_current_time (void);
```
+176
View File
@@ -0,0 +1,176 @@
## Reference counting in JerryScript
In JerryScript all `jerry_value_t` values are independent
references to internal objects. Values returned by JerryScript
API functions are always live references and must be released
by `jerry_value_free`.
```c
jerry_value_t global = jerry_current_realm ();
/* The value stored in the 'global' variable contains a live
* reference to the global object. The system also keeps its
* own live reference to the global object. These two references
* are independent, and both must be destroyed before the global
* object can be freed. */
jerry_value_free (global);
/* Without jerry_value_free() the global object will not
* be freed even by jerry_cleanup(). After the reference
* is released it becomes a dead reference and cannot be
* used anymore. */
```
Multiple references might refer to the same internal object
even though their `jerry_value_t` representation might be different.
```c
jerry_value_t pi_ref1 = jerry_number (3.14);
jerry_value_t pi_ref2 = jerry_value_copy (pi_ref1);
/* Both pi_ref1 and pi_ref2 refer to the same 3.14 value
* although they might not be equal in C (pi_ref1 != pi_ref2). */
/* Both references must be released. */
jerry_value_free (pi_ref1);
jerry_value_free (pi_ref2);
```
Releasing the same `jerry_value_t` twice to release two live
references is not allowed and it might cause crashes. Hence the
following code is an **INCORRECT WAY** of releasing the 3.14 value.
```c
jerry_value_free (pi_ref1);
jerry_value_free (pi_ref1);
```
JerryScript API functions returning with a `jerry_value_t` always
return with a new live reference. Passing a `jerry_value_t` to
an API function never releases its reference (unless explicitly
stated in the documentation). The next example shows this
behaviour through property getting and setting.
```c
jerry_value_t prop_value = jerry_object_get (...);
/* The prop_value must be released later because both the base
* object and the prop_value have an independent reference to
* the same JavaScript value. When the operation fails, the
* prop_value contains a live reference to an error object.
* This reference must be released as well. */
if (jerry_value_is_exception (prop_value))
{
/* Errors can be handled here. */
}
else
{
/* The application has a live reference to the property
* value even if the base object is freed by the garbage
* collector. */
}
/* The prop_value must be released. */
jerry_value_free (prop_value);
/* Property setting is the same. */
jerry_value_t new_prop_value = jerry_number (2.718);
jerry_value_t result = jerry_object_set (..., new_prop_value);
/* If the property set is successful, a new reference is created
* for the value referenced by new_prop_value. The new_prop_value
* reference must be released regardless of whether the operation
* is successful. */
/* The new_prop_value can be passed to other JerryScript API
* functions before the jerry_value_free () call. */
jerry_value_free (new_prop_value);
/* The reference stored in the 'result' variable is live whether
* the operation is successful or not, and must also be freed. */
if (jerry_value_is_exception (result))
{
/* Errors can be handled here. */
}
else
{
/* A reference to a true primitive value is returned. */
}
jerry_value_free (result);
```
The simplest form of setting a property without error checking
is the following:
```c
/* There are no 'ifs' in this snippet. */
jerry_value_free (jerry_object_set (..., new_prop_value));
jerry_value_free (new_prop_value);
```
The reference returned by a `jerry_external_handler_t` callback
transfers the ownership of the live reference. Otherwise the
referenced object could be freed by the garbage collector.
```c
jerry_value_t my_external_handler (const jerry_value_t function_obj,
const jerry_value_t this_val,
const jerry_value_t args_p[],
const jerry_length_t args_count
{
/* Do not release function_obj, this_val, and args_p because
* these references are automatically released after the handler
* is returned. This approach reduces code size which is useful
* on embedded systems. However you can create other references
* to them by calling jerry_value_copy () if needed. */
/* Since the ownership of the reference is transferred to the
* caller the following snippet is valid. */
/* If the value to be returned is needed for other purposes the
* jerry_value_copy () can be used to create new references. */
return jerry_string (...);
}
```
Duplicating a `jerry_value_t` in C does not create another live reference.
```c
jerry_value_t undef = jerry_undefined ();
jerry_value_t undef2 = undef;
/* Releasing either undef or undef2 is valid but not both.
* After the release both references become dead (invalid). */
jerry_value_free (undef2);
/* Dead references can be reassigned again. */
undef = jerry_boolean (true);
```
References can be duplicated in C as long as only one of them is freed.
```c
jerry_value_t a = jerry_boolean (true);
jerry_value_t b = a;
jerry_value_t c = a;
/* A new reference is assigned to 'a'. */
a = jerry_boolean (false);
[...]
jerry_value_free (a);
/* The 'a' (boolean false) reference becomes dead (invalid). */
jerry_value_free (c);
/* Both 'b' and 'c' (boolean true) references become dead. */
/* Since all references are released, no memory leak occurs. */
```
+415
View File
@@ -0,0 +1,415 @@
## JerryScript debugger interface
JerryScript provides a remote debugger which allows debugging
JavaScript programs. The debugger has two main components:
a server which is part of the JerryScript binary and a
separate client application. Currently a Python-based debugger
client is available in the /jerry-debugger subdirectory.
This simple application demonstrates the communication protocol
between the client and server, and can be reused by integrated
development environments.
## Setting up the debugger server
The following arguments must be passed to `tools/build.py`:
`--jerry-debugger=on`
The transport layer of the communication protocol is pluggable.
At the moment, a WebSocket-based implementation is provided as a
JerryScript extension, which transmits messages over TCP/IP networks.
If necessary/implemented, any reliable stream or datagram based
protocol can be used for transmitting debugger messages.
## Debugging JavaScript applications
The debugger client must be connected to the server before the
JavaScript application runs. On-the-fly attachment is supported
for more than one file, right after the engine initialization
(this feature is available with the python client). The debugging
information (e.g. line index of each possible breakpoint location)
is not preserved by JerryScript. The client is expected to be run
on a system with much more resources and it should be capable of
storing this information. JerryScript frees all debug information
after it is transmitted to the client to save memory.
The following argument makes JerryScript wait for a client
connection:
`--start-debug-server`
The following argument makes JerryScript wait for a client
source code:
`--debugger-wait-source`
It is also recommended to increase the log level to see
the *Waiting for client connection* message:
`--log-level 2`
The Python client can connect to the server by specifying its
IP address on the command line. The address can be localhost
if the server and the client are running on the same machine.
After the connection is established the execution can be
controlled by the debugger. The debugger always stops at
the first possible breakpoint location. The effect is the
same as using the `stop` command. This allows inserting
breakpoints right before the meaningful part of the execution
starts.
All available commands of the client can be queried by the
`help` command.
## Integrating debugger support into applications using JerryScript
When using the extension-provided WebSocket transport layer, the
debugger can be enabled by calling `jerryx_debugger_after_connect
(jerryx_debugger_tcp_create (debug_port) && jerryx_debugger_ws_create ())`
after the `jerry_init ()` function. It initializes the debugger and
blocks until a client connects.
(Custom transport layers may be implemented and initialized similarly.
Currently, `jerryx_debugger_rp_create ()` for raw packet transport layer and
`jerryx_debugger_serial_create (const char* config)` for serial protocol
are also available.)
The source name provided to `jerry_parse ()` is used by the client
to identify the source name of the source code. This source name
is usually a file name.
## JerryScript debugger C-API interface
The following section describes the debugger functions
available to the host application.
## JerryScript debugger types
## jerry_debugger_wait_for_source_callback_t
**Summary**
This callback function is called by
[jerry_debugger_wait_for_client_source](#jerry_debugger_wait_for_client_source)
when a source code is received successfully.
**Prototype**
```c
typedef jerry_value_t
(*jerry_debugger_wait_for_source_callback_t) (const jerry_char_t *source_name_p,
size_t source_name_size,
const jerry_char_t *source_p,
size_t source_size,
void *user_p);
```
- `source_name_p` - source (usually a file) name of the source code
- `source_name_size` - size of source name
- `source_p` - source code character data
- `source_size` - size of source code
- `user_p` - custom pointer passed to [jerry_debugger_wait_for_client_source](#jerry_debugger_wait_for_client_source)
## JerryScript debugger functions
### jerry_debugger_is_connected
**Summary**
Returns true if a remote debugger client is connected.
**Prototype**
```c
bool
jerry_debugger_is_connected (void);
```
**Example**
[doctest]: # (test="link")
```c
#include <stdio.h>
#include "jerryscript.h"
#include "jerryscript-ext/debugger.h"
int
main (void)
{
jerry_init (JERRY_INIT_EMPTY);
jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)
&& jerryx_debugger_ws_create ());
if (jerry_debugger_is_connected ())
{
printf ("A remote debugger client is connected.");
}
jerry_cleanup ();
}
```
### jerry_debugger_stop
**Summary**
Stops execution at the next available breakpoint if a remote
debugger client is connected and the engine is not waiting at
a breakpoint. The engine will stop regardless the breakpoint
is enabled or not.
**Prototype**
```c
void
jerry_debugger_stop (void)
```
**Example**
[doctest]: # (test="link")
```c
#include "jerryscript.h"
#include "jerryscript-ext/debugger.h"
int
main (void)
{
jerry_init (JERRY_INIT_EMPTY);
jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)
&& jerryx_debugger_ws_create ());
jerry_debugger_stop ();
jerry_cleanup ();
}
```
**See also**
- [jerry_debugger_continue](#jerry_debugger_continue)
### jerry_debugger_continue
**Summary**
If the engine would stop at the next available breakpoint it
cancels this effect. The engine will still stop at enabled
breakpoints. This function effectively negates the effect of
[jerry_debugger_stop ()](#jerry_debugger_stop) calls or stop
requests issued by the debugger client.
**Prototype**
```c
void
jerry_debugger_continue (void)
```
**Example**
[doctest]: # (test="link")
```c
#include "jerryscript.h"
#include "jerryscript-ext/debugger.h"
int
main (void)
{
jerry_init (JERRY_INIT_EMPTY);
jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)
&& jerryx_debugger_ws_create ());
jerry_debugger_continue ();
jerry_cleanup ();
}
```
**See also**
- [jerry_debugger_stop](#jerry_debugger_stop)
### jerry_debugger_stop_at_breakpoint
**Summary**
Enables or disables stopping at breakpoints. When stopping is
disabled all breakpoints are ignored including user enabled
breakpoints. This allows hidden execution of ECMAScript code.
**Prototype**
```c
void
jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint)
```
- `enable_stop_at_breakpoint` - enable (=`true`) or disable (=`false`) stopping at breakpoints
**Example**
[doctest]: # (test="link")
```c
#include "jerryscript.h"
#include "jerryscript-ext/debugger.h"
int
main (void)
{
jerry_init (JERRY_INIT_EMPTY);
jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)
&& jerryx_debugger_ws_create ());
jerry_debugger_stop_at_breakpoint (true);
// Protected execution of JavaScript code.
const jerry_char_t script[] = "42";
jerry_eval (script, sizeof (script) - 1, JERRY_PARSE_NO_OPTS);
jerry_debugger_stop_at_breakpoint (false);
jerry_cleanup ();
}
```
### jerry_debugger_wait_for_client_source
**Summary**
Asks the client to provide the next source code. The function
waits until the whole source code is received. As a reply the
the client may request a context reset or notify that no more
source is available. These notifications are passed back as the
return value of the function.
**Prototype**
```c
jerry_debugger_wait_for_source_status_t
jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p,
void *user_p,
jerry_value_t *return_value)
```
**Example**
[doctest]: # (test="link")
```c
#include "jerryscript.h"
#include "jerryscript-ext/debugger.h"
/**
* Runs the source code received by jerry_debugger_wait_for_client_source.
*/
static jerry_value_t
wait_for_source_callback (const jerry_char_t *source_name_p, /**< source name */
size_t source_name_size, /**< size of source name */
const jerry_char_t *source_p, /**< source code */
size_t source_size, /**< source code size */
void *user_p /**< user pointer */)
{
(void) user_p;
jerry_parse_options_t parse_options;
parse_options.options = JERRY_PARSE_HAS_SOURCE_NAME;
parse_options.source_name = jerry_string ((const jerry_char_t *) source_name_p,
(jerry_size_t) source_name_size,
JERRY_ENCODING_UTF8);
jerry_value_t ret_val = jerry_parse (source_p,
source_size,
&parse_options);
jerry_value_free (parse_options.source_name);
if (!jerry_value_is_exception (ret_val))
{
jerry_value_t func_val = ret_val;
ret_val = jerry_run (func_val);
jerry_value_free (func_val);
}
return ret_val;
} /* wait_for_source_callback */
int
main (void)
{
jerry_debugger_wait_for_source_status_t receive_status;
do
{
/* Create a new JerryScript instance when a context reset is
* received. Applications usually registers their core bindings
* here as well (e.g. print, setTimeout). */
jerry_init (JERRY_INIT_EMPTY);
jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)
&& jerryx_debugger_ws_create ());
do
{
jerry_value_t run_result;
receive_status = jerry_debugger_wait_for_client_source (wait_for_source_callback,
NULL,
&run_result);
jerry_value_free (run_result);
}
while (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVED);
jerry_cleanup ();
}
while (receive_status == JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED);
if (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED)
{
// Handle the failure (e.g. display an error).
}
return 0;
}
```
### jerry_debugger_send_output
**Summary**
Sends the program's output to the debugger client.
**Prototype**
```c
void
jerry_debugger_send_output (const jerry_char_t *buffer, jerry_size_t str_size)
```
**Example**
[doctest]: # (test="link")
```c
#include "jerryscript.h"
#include "jerryscript-ext/debugger.h"
int
main (void)
{
jerry_init (JERRY_INIT_EMPTY);
jerryx_debugger_after_connect (jerryx_debugger_tcp_create (5001)
&& jerryx_debugger_ws_create ());
jerry_char_t my_output[] = "Hey, this should be sent too!";
jerry_size_t my_output_size = sizeof (my_output);
jerry_debugger_send_output (my_output, my_output_size);
jerry_cleanup ();
}
```
+803
View File
@@ -0,0 +1,803 @@
# JerryScript Coding Standards
This text is a brief overview of JerryScript Coding Standards.
Each rule starts with a short description followed by several
examples. We believe examples are better than long explanations.
Please follow these guidelines when you submit a patch for
review.
## General rules
* Indentation is two spaces.
* Tab characters are not allowed.
* Maximum line length is 120 characters (excluding newline).
* No trailing white space is allowed.
* Run `tools/run-tests.py --check-format` to check several
of the coding conventions automatically.
## Comments
Only block comments (`/* */`) are allowed in JerryScript.
Comments should be complete sentences (e.g. start with an
upper case letter), except for return value, field and
argument descriptions (see the exceptions below). The
text part of a comment should focus on explaining *why*
the code is doing something rather than *what* the code
is doing.
```diff
+++ Good +++
```
```c
/* A perfect comment. */
/* A perfect multiline
* comment. Each line should
* start with an asterisk. */
```
```diff
--- Bad ---
```
```c
// Double slash comments are not allowed.
/* not a complete sentence */
/* A bad multiline
comment. */
```
All types, constants and functions require a description in
JerryScript. These comments should start with `/**`. The starting
`/**` and ending `*/` must be on separate lines.
```diff
+++ Good +++
```
```c
/**
* A correct description.
*/
```
```diff
--- Bad ---
```
```c
/** An incorrect description. */
```
## Preprocessor defines
The name of a preprocessor macro must be an uppercase string
and these macros must be preceded by a description.
Abbreviations are allowed but not preferred in new code.
```diff
+++ Good +++
```
```c
/**
* Short description about the constant.
*/
#define JERRY_VALUE_SEVEN 7
/**
* Short description about the macro function.
*/
#define JERRY_ADD_TWO_NUMBERS(arg1, arg2) \
((arg1) + (arg2))
/**
* Although this is correct, a reviewer might request
* to change NUMS to NUMBERS. Hence it is recommended
* to use NUMBERS in the first place.
*/
#define JERRY_ADD_TWO_NUMS(arg1, arg2) \
((arg1) + (arg2))
```
```diff
--- Bad ---
```
```c
#define JERRY_CONSTANT_WITHOUT_DESCRIPTION 5
#define JeRrY_mIxEd_CaSe_NaMe "str"
```
## Conditional preprocessor directives
A comment is required after `#else` and `#endif` in JerryScript.
The defined keyword should be omitted from these comments.
```diff
+++ Good +++
```
```c
#ifdef JERRY_A
#else /* !JERRY_A */
#endif /* JERRY_A */
#ifdef JERRY_A
#if defined JERRY_B && defined JERRY_C && (JERRY_C > 6)
#else /* !(JERRY_B && JERRY_C && (JERRY_C > 6)) */
#endif /* JERRY_B && JERRY_C && (JERRY_C > 6) */
#endif /* JERRY_A */
```
```diff
--- Bad ---
```
```c
#ifdef JERRY_A
#endif
#ifdef JERRY_A
#endif /* defined JERRY_A */
#ifdef JERRY_B
/* Missing comment after else. */
#else
#endif /* JERRY_B */
```
## Code blocks
Each code block must be enclosed in curly braces even
if it is a single line statement. These braces must
be on separate lines. There must be a single space
before the opening parenthesis of the expression
after if/while/switch keywords.
```diff
+++ Good +++
```
```c
if (value > 6)
{
function_call ();
}
if (value > 1)
{
function_call_a ();
}
else
{
function_call_b ();
}
do
{
function_call ();
value++;
}
while (value < 6);
switch (value)
{
case A:
{
/* FALLTHRU comment is allowed if a
* switch-case is not terminated by
* break/continue/return. */
/* FALLTHRU */
}
case B:
case C:
{
break;
}
case D:
{
/* We can use continue if we are in a loop. */
continue;
}
default:
{
return;
}
}
```
```diff
--- Bad ---
```
```c
if (value > 6)
function_call_a ();
else
function_call_b ();
if (value > 6) {
function_call_a ();
}
if (value > 6) function_call_a ();
else { function_call_b (); }
if
(value > 6)
{
}
switch (value) {
case 0: break;
default: {
return 5;
}
}
switch (value)
{
case A:
{
if (value > 6)
{
CASE B:
{
/* This is allowed in C but
* not in JerryScript. */
break;
}
}
}
}
do
value++;
while (value < 5);
do {
value++;
} while (value < 5);
do
{
value++;
} while (value < 5);
```
## Newlines
A newline in JerryScript is a separator which separates different
parts of the source code. Its primary purpose is to improve
readability. Unlike other rules developers have some freedom
to add newlines to their code. However there are some rules.
* Only a single newline separator is allowed.
* Source files must be terminated by a newline.
* Global declarations must be separated by a newline.
* Newlines are not allowed after an opening curly brace or before
a closing curly brace
* No newlines are allowed between control statements (if-else, while,
for, switch, etc.) and their code blocks.
* There should be a newline after the variable declarations
if they are the first statements of a block.
```diff
+++ Good +++
```
```c
if (a > 5)
{
/* Newline must be present after the first
* variable declarations of a code block. */
int j = a - 1;
int k = a * 2;
return j + k;
}
while (a < 5)
{
a++;
/* It is recommended to put a newline after
* intermediate variable declarations. */
int i = a * 2;
b = i - 3;
}
/* It is a recommended to put newlines around asserts. */
a = b + 5;
JERRY_ASSERT (a < 20);
c = a + 7;
/* It is a good practice to put a newline after a multiline
* function call (see Function calls later). */
f (a,
b,
c);
a = 6;
```
```diff
--- Bad ---
```
```c
/* No newlines are allowed after an opening curly
* brace or before a closing curly brace */
while (a > 0)
{
a = 6;
}
if (a > 5)
{
while (b < 6)
{
b++;
}
}
/* Two or more newlines are not allowed. */
a = 6;
b = 7;
/* No newlines are allowed between control statements
* and their code blocks. */
if (a > 6)
{
}
else
{
}
do
{
}
while (a < 6);
```
## Expressions
Spaces are required around binary operators. No space is
needed otherwise.
```diff
+++ Good +++
```
```c
a = b + c;
a = (b + c) << 3;
a = b = c + ~d;
a += ++c + d++;
call_function (a * (b + !!c) - d + (e % f));
if (a)
{
}
```
```diff
--- Bad ---
```
```c
a=b+c;
a = b+c;
a += c + ( d );
/* Introduce temporary variables or macros
* if the expression is too long. Occurs rarely.. */
a = b
+ c;
if ( a + b > 0 )
{
}
```
## Logical operators
All expressions with && and || logical operators must be
enclosed in parentheses. A single and multiline form is
allowed for these expressions. In the latter case each
line must start with the logical operator and each line
must be aligned to the column right after the opening
parenthesis.
```diff
+++ Good +++
```
```c
/* Single line form. */
a = ((c && d) || (e && f));
a = (c
&& d);
a = (c
&& (d || e)
&& f);
do
{
}
while (a
&& b);
/* This form is rarely used but it is ok. */
if (a
&& (b
|| c
|| d)
&& e)
{
}
```
```diff
--- Bad ---
```
```c
if (a || b ||
c)
{
}
/* Parentheses are missing. */
a = b || c;
/* Misaligned &&. */
if (a
&& b)
{
}
```
## Ternary conditional operators
A special form of ternary conditional operators are allowed
in JerryScript where the ? and : operators are on separate
lines in the same column.
```diff
+++ Good +++
```
```c
a = (b ? c
: d);
/* Single line form is accepted as well. */
a = (b ? c : d);
/* This form is rarely used but it is ok. */
if (a ? b
: (c ? d
: e))
{
}
```
```diff
--- Bad ---
```
```c
a = b ?
c : d;
while (a ? b
: c)
{
}
if (a
? b
: c)
{
}
```
## Function calls
There must be a space after the function name. Each argument
must be in the same or separated lines. In the former case
there must be a space before the next argument and in the
latter case all arguments must be aligned to the same column.
```diff
+++ Good +++
```
```c
function_a ();
function_b (a);
function_c (a, b, c);
function_c (a,
b,
c);
function_c (a,
b,
function_c (a,
b,
c);
```
```diff
--- Bad ---
```
```c
/* No space before the opening parenthesis. */
function_f();
function_f (
);
function_g(a);
function_g
(a
);
/* Two arguments on the same line. */
function_h (a, b,
c);
function_h (a,
b, c);
/* Misaligned arguments. */
function_h (a,
b,
c);
```
## Variable declarations
JerryScript is a pure C99 codebase so variable
declarations can be anywhere in the code including
inside for-loops. It is recommended to declare a
variable before the first use.
```diff
+++ Good +++
```
```c
for (int i = 0; i < 10; i++)
{
int j = i + 1;
while (j < 10)
{
++j;
}
}
/* Multiline form of for loops. */
for (int i = 0;
i < 10;
i++)
{
}
```
## Type casting
There must be a space after the closing parenthesis
of the type cast. Type casting has no multiline form
in JerryScript.
```diff
+++ Good +++
```
```c
int a = (int) double_variable;
int a = (int) (long) (float) double_variable;
```
```diff
--- Bad ---
```
```c
/* Wrong spaces. */
int a = ( int )double_variable;
/* No multiline form. */
int a = (int)
double_variable;
```
## Pointers and asterisk character
Each pointer in JerryScript must be a lowercase string
which is ending with a `_p` suffix. Furthermore there
must be a space before the asterisk character.
```diff
+++ Good +++
```
```c
int *int_p;
/* No need to add multiple _p-s for multiple indirections.
* It is recommended to avoid these constructs using typedef
* declarations. A reviewer might request such a change. */
int ***int_p;
/* This rule applies for type casting as well. */
char = *(char *) type_p;
```
```diff
--- Bad ---
```
```c
/* No _p after the name. */
int *ptr;
/* Wrong asterisk position. */
int* ptr_p;
char_p = * (char*)type_p;
```
## Types
Each type in JerryScript must be a lowercase string
which ends with a `_t` suffix. Furthermore each type
declaration must be preceded by a short description
of the type and each field must have a short description
as well.
```diff
+++ Good +++
```
```c
/**
* Short description of the following structure.
*/
typedef struct
{
/* Field descriptions do not start with capital letters
* and there is no full stop at the end. */
field1_t field1; /**< description of field 1 */
field2_t field2; /**< description of field 2 */
field_n_t field_n; /**< description of field n */
} structure_name_t;
/**
* Another integer type.
*/
typedef int jerry_int;
```
```diff
--- Bad ---
```
```c
typedef struct
{
field_t field_without_description;
} structure_without_description_t;
typedef struct { int a; } single_line_struct;
typedef
union {
}
wrong_newlines_t;
/*
* Bad comment format.
*/
typedef
char wrong_newlines_again_t;
```
### Type usage conventions
- 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`
## Function declarations
Function declarations in JerryScript are verbose but this format
reduces the maintenance cost and allows faster understanding of
the code.
```diff
+++ Good +++
```
```c
/**
* Short overview about the purpose of this function.
*
* A more detailed explanation if needed.
*
* Note:
* Extra notes if needed.
*
* @return short description about the value
* returned by the function
*/
return_value_type_t
function_name (argument1, /**< description of argument1 */
argument2, /**< description of argument2 */
...
argument_n, /**< description of argument n */
{
/* Function body. */
} /* function_name */
```
```diff
--- Bad ---
```
```c
static int
print (char *text) /**< description of text argument */
{
/* Missing comment before the function. */
} /* print */
/**
* Prints the text received by the function.
*
* @return number of characters printed by the function
*/
int print(char *text)
{
/* No description of text argument. */
/* Missing comment at the end of the function. */
}
```
+894
View File
@@ -0,0 +1,894 @@
# jerryx_arg types
## jerryx_arg_t
**Summary**
The structure defining a single validation/transformation step.
*Note*: For commonly used validators, `arg.h` provides helpers to create the `jerryx_arg_t`s.
For example, `jerryx_arg_number ()`, `jerryx_arg_boolean ()`, etc.
**Prototype**
```c
typedef struct
{
/** the transform function */
jerryx_arg_transform_func_t func;
/** pointer to destination where func should store the result */
void *dest;
/** extra information, specific to func */
uintptr_t extra_info;
} jerryx_arg_t;
```
**See also**
- [jerryx_arg_number](#jerryx_arg_number)
- [jerryx_arg_boolean](#jerryx_arg_boolean)
- [jerryx_arg_string](#jerryx_arg_string)
- [jerryx_arg_utf8_string](#jerryx_arg_utf8_string)
- [jerryx_arg_function](#jerryx_arg_function)
- [jerryx_arg_native_pointer](#jerryx_arg_native_pointer)
- [jerryx_arg_ignore](#jerryx_arg_ignore)
- [jerryx_arg_object_properties](#jerryx_arg_object_properties)
## jerryx_arg_object_props_t
**Summary**
The structure is used in `jerryx_arg_object_properties`. It provides the properties' names,
its corresponding JS-to-C mapping and other related information.
**Prototype**
```c
typedef struct
{
const jerry_char_t **name_p; /**< property name list of the JS object */
jerry_length_t name_cnt; /**< count of the name list */
const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */
jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */
} jerryx_arg_object_props_t;
```
**See also**
- [jerryx_arg_object_properties](#jerryx_arg_object_properties)
## jerryx_arg_array_items_t
**Summary**
The structure is used in `jerryx_arg_array`. It provides the array items' corresponding
JS-to-C mappings and count.
**Prototype**
```c
typedef struct
{
const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */
jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */
} jerryx_arg_array_items_t;
```
**See also**
- [jerryx_arg_array](#jerryx_arg_array)
## jerryx_arg_transform_func_t
**Summary**
Signature of the transform function.
Users can create custom transformations by implementing a transform function
and using `jerryx_arg_custom ()`.
The function is expected to return `undefined` if it ran successfully or
return an `Error` in case it failed. The function can use the iterator and the
helpers `jerryx_arg_js_iterator_pop ()` and `jerryx_arg_js_iterator_peek ()` to
get the next input value.
*Note*: A transform function is allowed to consume any number of input values!
This enables complex validation like handling different JS function signatures,
mapping multiple input arguments to a C struct, etc.
The function is expected to store the result of
a successful transformation into `c_arg_p->dest`. In case the validation did
not pass, the transform should not modify `c_arg_p->dest`.
Additional parameters can be provided to the function through `c_arg_p->extra_info`.
**Prototype**
```c
typedef jerry_value_t (*jerryx_arg_transform_func_t) (jerryx_arg_js_iterator_t *js_arg_iter_p,
const jerryx_arg_t *c_arg_p);
```
**See also**
- [jerryx_arg_custom](#jerryx_arg_custom)
- [jerryx_arg_js_iterator_pop](#jerryx_arg_js_iterator_pop)
- [jerryx_arg_js_iterator_peek](#jerryx_arg_js_iterator_peek)
## jerryx_arg_coerce_t
Enum that indicates whether an argument is allowed to be coerced into the expected JS type.
- JERRYX_ARG_COERCE - the transform will invoke toNumber, toBoolean, toString, etc.
- JERRYX_ARG_NO_COERCE - the type coercion is not allowed. The transform will fail if the type does not match the expectation.
**See also**
- [jerryx_arg_number](#jerryx_arg_number)
- [jerryx_arg_boolean](#jerryx_arg_boolean)
- [jerryx_arg_string](#jerryx_arg_string)
## jerryx_arg_optional_t
Enum that indicates whether an argument is optional or required.
- JERRYX_ARG_OPTIONAL - The argument is optional. If the argument is `undefined` the transform is successful and `c_arg_p->dest` remains untouched.
- JERRYX_ARG_REQUIRED - The argument is required. If the argument is `undefined` the transform will fail and `c_arg_p->dest` remains untouched.
**See also**
- [jerryx_arg_number](#jerryx_arg_number)
- [jerryx_arg_boolean](#jerryx_arg_boolean)
- [jerryx_arg_string](#jerryx_arg_string)
- [jerryx_arg_function](#jerryx_arg_function)
- [jerryx_arg_native_pointer](#jerryx_arg_native_pointer)
## jerryx_arg_round_t
Enum that indicates the rounding policy which will be chosen to transform an integer.
- JERRYX_ARG_ROUND - use round() method.
- JERRYX_ARG_FLOOR - use floor() method.
- JERRYX_ARG_CEIL - use ceil() method.
**See also**
- [jerryx_arg_uint8](#jerryx_arg_uint8)
- [jerryx_arg_uint16](#jerryx_arg_uint16)
- [jerryx_arg_uint32](#jerryx_arg_uint32)
- [jerryx_arg_int8](#jerryx_arg_int8)
- [jerryx_arg_int16](#jerryx_arg_int16)
- [jerryx_arg_int32](#jerryx_arg_int32)
## jerryx_arg_clamp_t
Indicates the clamping policy which will be chosen to transform an integer.
If the policy is NO_CLAMP, and the number is out of range,
then the transformer will throw a range error.
- JERRYX_ARG_CLAMP - clamp the number when it is out of range
- JERRYX_ARG_NO_CLAMP - throw a range error
**See also**
- [jerryx_arg_uint8](#jerryx_arg_uint8)
- [jerryx_arg_uint16](#jerryx_arg_uint16)
- [jerryx_arg_uint32](#jerryx_arg_uint32)
- [jerryx_arg_int8](#jerryx_arg_int8)
- [jerryx_arg_int16](#jerryx_arg_int16)
- [jerryx_arg_int32](#jerryx_arg_int32)
# Main functions
## jerryx_arg_transform_this_and_args
**Summary**
Validate the this value and the JS arguments, and assign them to the native arguments.
This function is useful to perform input validation inside external function handlers (see `jerry_external_handler_t`).
**Prototype**
```c
jerry_value_t
jerryx_arg_transform_this_and_args (const jerry_value_t this_val,
const jerry_value_t *js_arg_p,
const jerry_length_t js_arg_cnt,
const jerryx_arg_t *c_arg_p,
jerry_length_t c_arg_cnt)
```
- `this_val` - `this` value. Note this is processed as the first value, before the array of arguments.
- `js_arg_p` - points to the array with JS arguments.
- `js_arg_cnt` - the count of the `js_arg_p` array.
- `c_arg_p` - points to the array of validation/transformation steps
- `c_arg_cnt` - the count of the `c_arg_p` array.
- return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.
**Example**
[doctest]: # (test="compile")
```c
#include "jerryscript.h"
#include "jerryscript-ext/arg.h"
/* JS signature: function (requiredBool, requiredString, optionalNumber) */
static jerry_value_t
my_external_handler (const jerry_value_t function_obj,
const jerry_value_t this_val,
const jerry_value_t args_p[],
const jerry_length_t args_count)
{
bool required_bool;
char required_str[16];
double optional_num = 1234.567; // default value
/* "mapping" defines the steps to transform input arguments to C variables. */
const jerryx_arg_t mapping[] =
{
/* `this` is the first value. No checking needed on `this` for this function. */
jerryx_arg_ignore (),
jerryx_arg_boolean (&required_bool, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_string (required_str, sizeof (required_str), JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_number (&optional_num, JERRYX_ARG_NO_COERCE, JERRYX_ARG_OPTIONAL),
};
/* Validate and transform. */
const jerry_value_t rv = jerryx_arg_transform_this_and_args (this_val,
args_p,
args_count,
mapping,
4);
if (jerry_value_is_exception (rv))
{
/* Handle error. */
return rv;
}
/*
* Validated and transformed successfully!
* required_bool, required_str and optional_num can now be used.
*/
return jerry_undefined (); /* Or return something more meaningful. */
}
```
**See also**
- [jerryx_arg_ignore](#jerryx_arg_ignore)
- [jerryx_arg_number](#jerryx_arg_number)
- [jerryx_arg_boolean](#jerryx_arg_boolean)
- [jerryx_arg_string](#jerryx_arg_string)
- [jerryx_arg_function](#jerryx_arg_function)
- [jerryx_arg_native_pointer](#jerryx_arg_native_pointer)
- [jerryx_arg_custom](#jerryx_arg_custom)
- [jerryx_arg_object_properties](#jerryx_arg_object_properties)
## jerryx_arg_transform_args
**Summary**
Validate an array of `jerry_value_t` and assign them to the native arguments.
**Prototype**
```c
jerry_value_t
jerryx_arg_transform_args (const jerry_value_t *js_arg_p,
const jerry_length_t js_arg_cnt,
const jerryx_arg_t *c_arg_p,
jerry_length_t c_arg_cnt)
```
- `js_arg_p` - points to the array with JS arguments.
- `js_arg_cnt` - the count of the `js_arg_p` array.
- `c_arg_p` - points to the array of validation/transformation steps
- `c_arg_cnt` - the count of the `c_arg_p` array.
- return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
## jerryx_arg_transform_object_properties
**Summary**
Validate the properties of a JS object and assign them to the native arguments.
*Note*: This function transforms properties of a single JS object into native C values.
To transform multiple objects in one pass (for example when converting multiple arguments
to an external handler), please use `jerryx_arg_object_properties` together with
`jerryx_arg_transform_this_and_args` or `jerryx_arg_transform_args`.
**Prototype**
```c
jerry_value_t
jerryx_arg_transform_object_properties (const jerry_value_t obj_val,
const jerry_char_t **name_p,
const jerry_length_t name_cnt,
const jerryx_arg_t *c_arg_p,
jerry_length_t c_arg_cnt);
```
- `obj_val` - the JS object.
- `name_p` - points to the array of property names.
- `name_cnt` - the count of the `name_p` array.
- `c_arg_p` - points to the array of validation/transformation steps
- `c_arg_cnt` - the count of the `c_arg_p` array.
- return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.
**See also**
- [jerryx_arg_object_properties](#jerryx_arg_object_properties)
## jerryx_arg_transform_array
**Summary**
Validate the JS array and assign its items to the native arguments.
*Note*: This function transforms items of a single JS array into native C values.
To transform multiple JS arguments in one pass, please use `jerryx_arg_array` together with
`jerryx_arg_transform_this_and_args` or `jerryx_arg_transform_args`.
**Prototype**
```c
jerry_value_t
jerryx_arg_transform_array (const jerry_value_t array_val,
const jerryx_arg_t *c_arg_p,
jerry_length_t c_arg_cnt);
```
- `array_val` - the JS array.
- `c_arg_p` - points to the array of validation/transformation steps
- `c_arg_cnt` - the count of the `c_arg_p` array.
- return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.
**See also**
- [jerryx_arg_array](#jerryx_arg_array)
## jerryx_arg_transform_optional
**Summary**
The common function to deal with optional arguments. The core transform function is provided by argument `func`.
**Prototype**
```c
jerry_value_t jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p,
const jerryx_arg_t *c_arg_p,
jerryx_arg_transform_func_t func);
```
- `js_arg_iter_p` - the JS arg iterator.
- `c_arg_p` - the native arg.
- `func` - the core transform function.
- return value - a `jerry_value_t` representing `undefined` if all validators passed or an `Error` if a validator failed.
**See also**
- [jerryx_arg_transform_func_t](#jerryx_arg_transform_func_t)
# Helpers for commonly used validations
## jerryx_arg_uint8
## jerryx_arg_uint16
## jerryx_arg_uint32
## jerryx_arg_int8
## jerryx_arg_int16
## jerryx_arg_int32
**Summary**
All above jerryx_arg_[u]intX functions are used to create a validation/transformation step
(`jerryx_arg_t`) that expects to consume one `number` JS argument
and stores it into a C integer (uint8, int8, uint16, ...)
**Prototype**
Take jerryx_arg_int32 as an example
```c
static inline jerryx_arg_t
jerryx_arg_int32 (int32_t *dest,
jerryx_arg_round_t round_flag,
jerryx_arg_clamp_t clamp_flag,
jerryx_arg_coerce_t coerce_flag,
jerryx_arg_optional_t opt_flag);
```
- return value - the created `jerryx_arg_t` instance.
- `dest` - pointer to the `int32_t` where the result should be stored.
- `round_flag` - the rounding policy.
- `clamp_flag` - the clamping policy.
- `coerce_flag` - whether type coercion is allowed.
- `opt_flag` - whether the argument is optional.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
## jerryx_arg_number
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to consume
one `number` JS argument and stores it into a C `double`.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_number (double *dest,
jerryx_arg_coerce_t coerce_flag,
jerryx_arg_optional_t opt_flag)
```
- return value - the created `jerryx_arg_t` instance.
- `dest` - pointer to the `double` where the result should be stored.
- `coerce_flag` - whether type coercion is allowed.
- `opt_flag` - whether the argument is optional.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
## jerryx_arg_boolean
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to
consume one `boolean` JS argument and stores it into a C `bool`.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_boolean (bool *dest,
jerryx_arg_coerce_t coerce_flag,
jerryx_arg_optional_t opt_flag)
```
- return value - the created `jerryx_arg_t` instance.
- `dest` - pointer to the `bool` where the result should be stored.
- `coerce_flag` - whether type coercion is allowed.
- `opt_flag` - whether the argument is optional.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
## jerryx_arg_string
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to
consume one `string` JS argument and stores it into a CESU-8 C `char` array.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_string (char *dest,
uint32_t size,
jerryx_arg_coerce_t coerce_flag,
jerryx_arg_optional_t opt_flag)
```
- return value - the created `jerryx_arg_t` instance.
- `dest` - pointer to the native char array where the result should be stored.
- `size` - the size of native char array.
- `coerce_flag` - whether type coercion is allowed.
- `opt_flag` - whether the argument is optional.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
- [jerry_arg_utf8_string](#jerry_arg_utf8_string)
## jerryx_arg_utf8_string
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to
consume one `string` JS argument and stores it into a UTF-8 C `char` array.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_utf8_string (char *dest,
uint32_t size,
jerryx_arg_coerce_t coerce_flag,
jerryx_arg_optional_t opt_flag)
```
- return value - the created `jerryx_arg_t` instance.
- `dest` - pointer to the native char array where the result should be stored.
- `size` - the size of native char array.
- `coerce_flag` - whether type coercion is allowed.
- `opt_flag` - whether the argument is optional.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
- [jerry_arg_string](#jerry_arg_string)
## jerryx_arg_function
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to
consume one `function` JS argument and stores it into a C `jerry_value_t`.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_function (jerry_value_t *dest,
jerryx_arg_optional_t opt_flag)
```
- return value - the created `jerryx_arg_t` instance.
- `dest` - pointer to the `jerry_value_t` where the result should be stored.
- `opt_flag` - whether the argument is optional.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
## jerryx_arg_native_pointer
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to
consume one `object` JS argument that is 'backed' with a native pointer with
a given type info. In case the native pointer info matches, the transform
will succeed and the object's native pointer will be assigned to `*dest`.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_native_pointer (void **dest,
const jerry_object_native_info_t *info_p,
jerryx_arg_optional_t opt_flag)
```
- return value - the created `jerryx_arg_t` instance.
- `dest` - pointer to where the resulting native pointer should be stored.
- `info_p` - expected the type info.
- `opt_flag` - whether the argument is optional.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
## jerryx_arg_object_properties
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to
consume one `object` JS argument and call `jerryx_arg_transform_object_properties` inside
to transform its properties to native arguments.
User should prepare the `jerryx_arg_object_props_t` instance, and pass it to this function.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_object_properties (const jerryx_arg_object_props_t *obj_prop_p,
jerryx_arg_optional_t opt_flag);
```
- return value - the created `jerryx_arg_t` instance.
- `obj_prop_p` - provides information for properties transform.
- `opt_flag` - whether the argument is optional.
**Example**
[doctest]: # (test="compile")
```c
#include "jerryscript.h"
#include "jerryscript-ext/arg.h"
/**
* The binding function expects args_p[0] is an object, which has 3 properties:
* "enable": boolean
* "data": number
* "extra_data": number, optional
*/
static jerry_value_t
my_external_handler (const jerry_value_t function_obj,
const jerry_value_t this_val,
const jerry_value_t args_p[],
const jerry_length_t args_count)
{
bool required_bool;
double required_num;
double optional_num = 1234.567; // default value
/* "prop_name_p" defines the name list of the expected properties' names. */
const char *prop_name_p[] = { "enable", "data", "extra_data" };
/* "prop_mapping" defines the steps to transform properties to C variables. */
const jerryx_arg_t prop_mapping[] =
{
jerryx_arg_boolean (&required_bool, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_number (&required_num, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_number (&optional_num, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL)
};
/* Prepare the jerryx_arg_object_props_t instance. */
const jerryx_arg_object_props_t prop_info =
{
.name_p = (const jerry_char_t **) prop_name_p,
.name_cnt = 3,
.c_arg_p = prop_mapping,
.c_arg_cnt = 3
};
/* It is the mapping used in the jerryx_arg_transform_args. */
const jerryx_arg_t mapping[] =
{
jerryx_arg_object_properties (&prop_info, JERRYX_ARG_REQUIRED)
};
/* Validate and transform. */
const jerry_value_t rv = jerryx_arg_transform_args (args_p,
args_count,
mapping,
1);
if (jerry_value_is_exception (rv))
{
/* Handle error. */
return rv;
}
/*
* Validated and transformed successfully!
* required_bool, required_num and optional_num can now be used.
*/
return jerry_undefined (); /* Or return something more meaningful. */
}
```
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
- [jerryx_arg_transform_object_properties](#jerryx_arg_transform_object_properties)
## jerryx_arg_array
**Summary**
Create a validation/transformation step (`jerryx_arg_t`) that expects to
consume one `array` JS argument and call `jerryx_arg_transform_array_items` inside
to transform its items to native arguments.
User should prepare the `jerryx_arg_array_items_t` instance, and pass it to this function.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p, jerryx_arg_optional_t opt_flag);
```
- return value - the created `jerryx_arg_t` instance.
- `array_items_p` - provides items information for transform.
- `opt_flag` - whether the argument is optional.
**Example**
[doctest]: # (test="compile")
```c
#include "jerryscript.h"
#include "jerryscript-ext/arg.h"
/**
* The binding function expects args_p[0] is an array, which has 3 items:
* first: boolean
* second: number
* third: number, optional
*/
static jerry_value_t
my_external_handler (const jerry_value_t function_obj,
const jerry_value_t this_val,
const jerry_value_t args_p[],
const jerry_length_t args_count)
{
bool required_bool;
double required_num;
double optional_num = 1234.567; // default value
/* "item_mapping" defines the steps to transform array items to C variables. */
const jerryx_arg_t item_mapping[] =
{
jerryx_arg_boolean (&required_bool, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_number (&required_num, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_number (&optional_num, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL)
};
/* Prepare the jerryx_arg_array_items_t instance. */
const jerryx_arg_array_items_t array_info =
{
.c_arg_p = item_mapping,
.c_arg_cnt = 3
};
/* It is the mapping used in the jerryx_arg_transform_args. */
const jerryx_arg_t mapping[] =
{
jerryx_arg_array (&array_info, JERRYX_ARG_REQUIRED)
};
/* Validate and transform. */
const jerry_value_t rv = jerryx_arg_transform_args (args_p,
args_count,
mapping,
1);
if (jerry_value_is_exception (rv))
{
/* Handle error. */
return rv;
}
/*
* Validated and transformed successfully!
* required_bool, required_num and optional_num can now be used.
*/
return jerry_undefined (); /* Or return something more meaningful. */
}
```
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
- [jerryx_arg_transform_object_properties](#jerryx_arg_transform_object_properties)
# Functions to create custom validations
## jerryx_arg_ignore
**Summary**
Create a jerryx_arg_t instance for ignored argument.
**Prototype**
```c
static inline jerryx_arg_t jerryx_arg_ignore (void);
```
- return value - the created `jerryx_arg_t` instance.
**See also**
- [jerryx_arg_t](#jerryx_arg_t)
## jerryx_arg_custom
**Summary**
Create a jerryx_arg_t instance with custom transform.
**Prototype**
```c
static inline jerryx_arg_t
jerryx_arg_custom (void *dest,
uintptr_t extra_info,
jerryx_arg_transform_func_t func)
```
- return value - the created `jerryx_arg_t` instance.
- `dest` - pointer to the native argument where the result should be stored.
- `extra_info` - the extra parameter data, specific to the transform function.
- `func` - the custom transform function.
**See also**
- [jerryx_arg_transform_this_and_args](#jerryx_arg_transform_this_and_args)
## jerryx_arg_js_iterator_pop
**Summary**
Pop the current `jerry_value_t` argument from the iterator.
It will change the `js_arg_idx` and `js_arg_p` value in the iterator.
**Prototype**
```c
jerry_value_t
jerryx_arg_js_iterator_pop (jerryx_arg_js_iterator_t *js_arg_iter_p)
```
- return value - the `jerry_value_t` argument that was popped.
- `js_arg_iter_p` - the JS arg iterator from which to pop.
## jerryx_arg_js_iterator_peek
**Summary**
Get the current JS argument from the iterator, without moving the iterator forward.
*Note:* Unlike `jerryx_arg_js_iterator_pop ()`, it will not change `js_arg_idx` and
`js_arg_p` value in the iterator.
**Prototype**
```c
jerry_value_t
jerryx_arg_js_iterator_peek (jerryx_arg_js_iterator_t *js_arg_iter_p)
```
- return value - the current `jerry_value_t` argument.
- `js_arg_iter_p` - the JS arg iterator from which to peek.
## jerryx_arg_js_iterator_restore
**Summary**
Restore the last item popped from the stack. This can be called as
many times as there are arguments on the stack -- if called when the
first element in the array is the current top of the stack, this
function does nothing.
*Note:* This function relies on the underlying implementation of the
arg stack as an array, as its function is to simply back up the "top
of stack" pointer to point to the previous element of the array.
*Note:* Like `jerryx_arg_js_iterator_pop ()`, this function will
change the `js_arg_idx` and `js_arg_p` values in the iterator.
**Prototype**
```c
jerry_value_t
jerryx_arg_js_iterator_restore (jerryx_arg_js_iterator_t *js_arg_iter_p)
```
- return value - the the new top of the stack.
- `js_arg_iter_p` - the JS arg iterator to restore.
## jerryx_arg_js_iterator_index
**Summary**
Get the index of the current JS argument from the iterator.
**Prototype**
```c
jerry_length_t
jerryx_arg_js_iterator_index (jerryx_arg_js_iterator_t *js_arg_iter_p)
```
- return value - the index of current JS argument.
- `js_arg_iter_p` - the JS arg iterator from which to peek.
+407
View File
@@ -0,0 +1,407 @@
# Common methods to handle properties
The `jerryscript-ext/properties.h` header defines a set of convenience methods
which makes the property access a bit straightforward.
# Utility to register multiple properties in bulk
In some cases it is useful to register multiple properties for a given object
for this the following utility structures and methods are provided.
## jerryx_property_entry
**Summary**
Structure to define an array of properties with `name` and `value` fields which
can be registered to a target object.
The engine must be initialized before specifying the `jerry_value_t` in the struct.
**Prototype**
```c
typedef struct {
const char *name;
jerry_value_t value;
} jerryx_property_entry;
```
**See also**
- [jerryx_set_properties](#jerryx_set_properties)
## jerryx_register_result
**Summary**
Structure returned as the result of the [jerryx_set_properties](#jerryx_set_properties) operation.
The `result` field will either be a JavaScript undefined value or an error object.
In every case the `registered` field is used to indicated the number of
successfully registered methods.
This must be passed for the [jerryx_release_property_entry](#jerryx_release_property_entry) method
after the property registration.
If any error occurred during the property registration the `result` field of the structure
must be manually released after processing the error value.
**Prototype**
```c
typedef struct {
jerry_value_t result;
uint32_t registered;
} jerryx_register_result;
```
**See also**
- [jerryx_set_properties](#jerryx_set_properties)
- [jerryx_release_property_entry](#jerryx_release_property_entry)
## jerryx_set_properties
**Summary**
Set multiple properties on a target object.
The properties are an array of (name, jerry_value_t) pairs and
this list must end with a (NULL, 0) entry.
Important notes:
* Each property value in the input array is released after a successful property registration.
* The method [jerryx_release_property_entry](#jerryx_release_property_entry) must be called if there is any failed registration
to release the values in the entries array.
It is safe to call this cleanup method in every case not just in case of failure.
* If the error value is reported via the result it must be freed manually.
**Prototype**
```c
jerryx_register_result
jerryx_set_properties (const jerry_value_t target_object,
const jerryx_property_entry entries[]);
```
- `target_object` - object on which the entries will be set.
- `entries` - array of (name, jerry_value_t) pairs.
- return a [jerryx_register_result](#jerryx_register_result).
- if everything is ok, the struct's `result` field is set to a JS undefined value.
- otherwise the `result` field is an error object indicating the problem.
- in every case the `registered` field contains the number of successfully registered properties.
**Example**
[doctest]: # ()
```c
#include <stdio.h>
#include "jerryscript.h"
#include "jerryscript-ext/handlers.h"
#include "jerryscript-ext/properties.h"
static jerry_value_t
handler (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt)
{
printf ("native handler called!\n");
return jerry_boolean (true);
}
int
main (int argc, char **argv)
{
jerry_init (JERRY_INIT_EMPTY);
jerryx_property_entry methods[] =
{
{ "demo", jerry_function_external (handler) },
{ NULL, 0 },
};
jerry_value_t global = jerry_current_realm ();
jerryx_register_result reg = jerryx_set_properties (global, methods);
/* if `reg.result` is undefined all methods are registered */
if (jerry_value_is_exception (reg.result))
{
printf ("Only registered %d properties\r\n", reg.registered);
/* clean up not registered property values */
jerryx_release_property_entry (methods, reg);
/* clean up the error */
jerry_value_free (reg.result);
}
jerry_value_free (global);
jerry_cleanup();
return 0;
}
```
**Convenience macros**
To make property registration convenient, there are a set of macros to use
when setting a property entry:
* `JERRYX_PROPERTY_NUMBER(NAME, NUMBER)` - creates a number entry.
* `JERRYX_PROPERTY_STRING(NAME, STR, SIZE)` - creates an UTF-8 string entry using `SIZE` bytes from the string.
* `JERRYX_PROPERTY_STRING_SZ(NAME, STR)` - creates an ASCII string entry. This string must be zero terminated.
* `JERRYX_PROPERTY_BOOLEAN(NAME, VALUE)` - creates a boolean entry.
* `JERRYX_PROPERTY_FUNCTION(NAME, NATIVE)` - creates a native C function entry.
* `JERRYX_PROPERTY_UNDEFINED(NAME)` - creates an undefined property entry.
* `JERRYX_PROPERTY_LIST_END()` - indicates the end of the property list.
**Example usage of Convenience macros**
[doctest]: # ()
```c
#include <stdio.h>
#include "jerryscript.h"
#include "jerryscript-ext/handlers.h"
#include "jerryscript-ext/properties.h"
static jerry_value_t
handler (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt)
{
printf ("native handler called!\n");
return jerry_boolean (true);
}
int
main (int argc, char **argv)
{
jerry_init (JERRY_INIT_EMPTY);
/**
* Create a array of properties to be registered.
* This must be done after initializing the engine as creating `jerry_value_t`
* elements are invalid before `jerry_init`.
*/
jerryx_property_entry methods[] =
{
JERRYX_PROPERTY_FUNCTION ("demo", handler),
JERRYX_PROPERTY_NUMBER ("test_num", 2.3),
JERRYX_PROPERTY_UNDEFINED ("this_is_undefined"),
JERRYX_PROPERTY_LIST_END(),
};
jerry_value_t global = jerry_current_realm ();
jerryx_register_result reg = jerryx_set_properties (global, methods);
/* if `reg.result` is undefined all methods are registered */
if (jerry_value_is_exception (reg.result))
{
printf ("Only registered %d properties\r\n", reg.registered);
/* clean up not registered property values */
jerryx_release_property_entry (methods, reg);
/* clean up the error */
jerry_value_free (reg.result);
}
jerry_value_free (global);
jerry_cleanup();
return 0;
}
```
**See also**
- [jerryx_property_entry](#jerryx_property_entry)
- [jerryx_release_property_entry](#jerryx_release_property_entry)
- [jerryx_register_result](#jerryx_register_result)
## jerryx_release_property_entry
**Summary**
Release all `jerry_value_t` in a `jerryx_property_entry` array based on a previous [jerryx_set_properties](#jerryx_set_properties) call
and also the error value (if any) in the `jerryx_register_result` structure.
In case of a successful registration it is safe to call this method.
After the method call the `entries` array should not be used as all values are released.
**Prototype**
```
void
jerryx_release_property_entry (const jerryx_property_entry entries[],
const jerryx_register_result register_result);
```
- `entries` - array of [jerryx_property_entry](#jerryx_property_entry).
- `register_result` - result of a previous [jerryx_set_properties](#jerryx_set_properties) call.
**Example**
For example usage see [jerryx_set_properties](#jerryx_set_properties).
# Common external function handlers
## jerryx_handler_assert
**Summary**
Hard assert for scripts. The routine calls `jerry_port_fatal` on assertion failure.
If the `JERRY_FEATURE_LINE_INFO` runtime feature is enabled (build option: `JERRY_LINE_INFO`)
a backtrace is also printed out.
**Prototype**
```c
jerry_value_t
jerryx_handler_assert (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt);
```
- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
structure which holds call related information (unused).
- `args_p` - the array of function arguments.
- `args_cnt` - the number of function arguments.
- return value - `jerry_value_t` representing boolean true, if only one argument
was passed and that argument was a boolean true. Note that the function does
not return otherwise.
**See also**
- [jerryx_register_global](#jerryx_register_global)
## jerryx_handler_gc
**Summary**
Expose garbage collector to scripts. If the first argument of the function
is logical true, it performs a high pressure gc. Otherwise a low pressure
gc is performed, which is also the default if no parameters passed.
**Prototype**
```c
jerry_value_t
jerryx_handler_gc (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt);
```
- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
structure which holds call related information (unused).
- `args_p` - the array of function arguments (unused).
- `args_cnt` - the number of function arguments (unused).
- return value - `jerry_value_t` representing `undefined`.
**See also**
- [jerryx_register_global](#jerryx_register_global)
## jerryx_handler_print
**Summary**
Provide a `print` implementation for scripts. The routine converts all of its
arguments to strings and outputs them by using `jerry_port_print_buffer`.
The NULL character is output as "\u0000", other characters are output bytewise.
*Note*: This implementation does not use standard C `printf` to print its
output. This allows more flexibility but also extends the core JerryScript
engine port API. Applications that want to use `jerryx_handler_print` must
ensure that their port implementation also provides
`jerry_port_print_buffer`.
**Prototype**
```c
jerry_value_t
jerryx_handler_print (const jerry_call_info_t *call_info_p,
const jerry_value_t args_p[],
const jerry_length_t args_cnt);
```
- `call_info_p` - pointer to a [jerry_call_info_t](#jerry_call_info_t)
structure which holds call related information (unused).
- `args_p` - the array of function arguments.
- `args_cnt` - the number of function arguments.
- return value - `jerry_value_t` representing `undefined` if all arguments could
be converted to strings, an `Error` otherwise.
**See also**
- [jerryx_register_global](#jerryx_register_global)
- [jerry_port_print_buffer](05.PORT-API.md#jerry_port_print_buffer)
# Handler registration helper
## jerryx_register_global
**Summary**
Register a JavaScript function in the global object.
*Note*: Returned value must be freed with `jerry_value_free`, when it is no
longer needed.
**Prototype**
```c
jerry_value_t
jerryx_register_global (const char *name_p,
jerry_external_handler_t handler_p);
```
- `name_p` - the name of the function to be registered.
- `handler_p` - the address of the external function handler.
- return value - `jerry_value_t` representing boolean true, if the operation was
successful, an `Error` otherwise.
**Example**
[doctest]: # (test="compile")
```c
#include "jerryscript.h"
#include "jerryscript-ext/handlers.h"
#include "jerryscript-ext/properties.h"
static const struct {
const char *name_p;
jerry_external_handler_t handler_p;
} common_functions[] =
{
{ "assert", jerryx_handler_assert },
{ "gc", jerryx_handler_gc },
{ "print", jerryx_handler_print },
{ NULL, NULL }
};
static void
register_common_functions (void)
{
jerry_value_t ret = jerry_undefined ();
for (int i = 0; common_functions[i].name_p != NULL && !jerry_value_is_exception (ret); i++)
{
ret = jerryx_register_global (common_functions[i].name_p,
common_functions[i].handler_p);
}
jerry_value_free (ret);
}
```
+50
View File
@@ -0,0 +1,50 @@
# Autorelease values
## JERRYX_AR_VALUE_T
**Summary**
Macro for `const jerry_value_t` for which jerry_value_free() is
automatically called when the variable goes out of scope.
*Note*: The macro depends on compiler support. For GCC and LLVM/clang, the macro is implemented
using the `__cleanup__` variable attribute. For other compilers, no support has been added yet.
**Example**
[doctest]: # (test="compile", name="11.EXT-REFERENCE-AUTORELEASE.c")
```c
#include "jerryscript.h"
#include "jerryscript-ext/autorelease.h"
static void
foo (bool enable)
{
JERRYX_AR_VALUE_T bar = jerry_string_sz ("...");
if (enable)
{
JERRYX_AR_VALUE_T baz = jerry_current_realm ();
/* bar and baz can now be used. */
/*
* jerry_value_free (baz) and jerry_value_free (bar) is called automatically before
* returning, because `baz` and `bar` go out of scope.
*/
return;
}
/*
* jerry_value_free (bar) is called automatically when the function returns,
* because `bar` goes out of scope.
*/
}
```
**See also**
- [jerry_value_t](../docs/02.API-REFERENCE.md#jerry_value_t)
- [jerry_value_copy](../docs/02.API-REFERENCE.md#jerry_value_copy)
- [jerry_value_free](../docs/02.API-REFERENCE.md#jerry_value_free)
+314
View File
@@ -0,0 +1,314 @@
# Module API
This is a JerryScript extension that provides a means of loading modules. Fundamentally, a module is a name (stored as
a string) that resolves to a `jerry_value_t`. This extension provides the function `jerryx_module_resolve()` which
accepts the name of the module being requested as well as an array of so-called "resolvers" - structures containing two
function pointers: one for a function which computes a canonical name for the requested module or returns a reference
to the requested name, and one that converts a canonical name to a `jerry_value_t`, thus "resolving" or "loading" the
requested module.
The resolvers are first called in sequence to each compute the canonical name of the requested module. This is
accomplished by calling the `get_canonical_name` function pointer they provide. If the function pointer is `NULL`, the
requested module name is assumed to be what the resolver considers to be its canonical name. `jerryx_module_resolve`
searches its cache of loaded modules for each canonical name as returned by a `get_canonical_name` function pointer. If
one of the loaded modules in the cache corresponds to a canonical name, it is returned.
If no cached module is found, `jerryx_module_resolve` calls each resolver's `resolve` function pointer, passing it its
previously computed interpretation of the requested module's canonical name. If the resolver successfully creates the
`jerry_value_t` that represents the loaded module, it returns `true` and the `jerry_value_t` in its out parameter.
When `jerryx_module_resolve` receives a value of `true` from a resolver, it stops iterating over the remaining
resolvers in the sequence and, if the `jerry_value_t` returned from the resolver's `resolve` does not have the error
flag set, it will add the `jerry_value_t` to its cache under the module's canonical name and return it. Thus, on
subsequent calls to `jerryx_module_resolve` with a module name whose canonical name is associated with the
`jerry_value_t`, no `resolve` callback need be called again.
The purpose of having resolvers is to be able to account for the fact that different types of modules may be structured
differently and thus, for each type of module a module resolver must be supplied at the point where an instance of that
type of module is requested.
Individual modules may be removed from the cache by calling `jerryx_module_clear_cache`. This function behaves
identically to `jerryx_module_resolve` in that it first checks the cache for the requested module, except that it
removes the module if found. Additionally, it clears the entire cache of all modules if called using a JavaScript value
of `undefined` as its first parameter.
Additionally, this extension provides a means of easily defining so-called "native" JerryScript modules which can be
resolved using the native JerryScript module resolver `jerryx_module_native_resolver`, which can be passed to
`jerryx_module_resolve()`. Native modules are registered during application startup and by calling `dlopen()` by means
of library constructors, support for which can be turned on using the `FEATURE_INIT_FINI` build flag. In the absence of
such a flag, the module registration and unregistration functions are exposed as global symbols which can be called
explicitly. Note: On windows, `FEATURE_INIT_FINI` build flag only supported with GNU toolchain or Microsoft Visual C/C++ Compiler
2008 and upper.
## jerryx_module_resolve
**Summary**
Load a copy of a module into the current context or return one that was already loaded if it is found.
For each resolver passed in via `resolvers_p`, its `get_canonical_name` function pointer gets called in order to
establish the resolver's interpretation of what the canonical name for the module should be. If `get_canonical_name` is
`NULL`, it is assumed that the requested module's name as passed in is its canonical name.
Then, for each resolver passed in via `resolvers_p`, its `resolve` function pointer gets called with its interpretation
of what the module's canonical name should be, as computed in the previous step.
If the resolver's `resolve` function pointer returns `true`, the `jerry_value_t` returned in its out-parameter will be
returned by `jerryx_module_resolve` as the result of the request. If no error flag is set on the `jerry_value_t` it
will be cached under its canonical name so as to avoid loading the same module twice in the event of a subsequent call
to `jerryx_module_resolve` with a module name whose canonical name matches an already loaded module.
**Prototype**
```c
jerry_value_t
jerryx_module_resolve (const jerry_value_t name,
const jerryx_module_resolver_t **resolvers_p,
size_t resolver_count);
```
- `name` - the name of the module to load
- `resolvers_p` - the list of resolvers to call in sequence
- `resolver_count` - the number of resolvers in `resolvers_p`
- return value - `jerry_value_t` representing the module that was loaded, or the error that occurred in the process.
## jerryx_module_clear_cache
**Summary**
Remove a module from the current context's cache, or clear the cache entirely.
**Prototype**
```c
void
jerryx_module_clear_cache (const jerry_value_t name,
const jerryx_module_resolver_t **resolvers_p,
size_t resolver_count);
```
- `name` - the name of the module to remove from cache or a JavaScript `undefined` to clear the entire cache
- `resolvers_p` - the list of resolvers to call in sequence
- `resolver_count` - the number of resolvers in `resolvers_p`
## jerryx_module_native_resolver
**Summary**
The resolver for native JerryScript modules. A pointer to this structure can be passed in the second parameter to
`jerryx_module_resolve` to search for the module among the native JerryScript modules built into the binary. This
function is available only if the preprocessor directive `JERRYX_NATIVE_MODULES_SUPPORTED` is defined.
**Prototype**
```c
extern jerry_module_resolver_t jerryx_native_module_resolver;
```
# Module data types
## jerryx_module_get_canonical_name_t
**Summary**
The function pointer type for converting a module's requested name to its canonical name.
**Prototype**
```c
typedef jerry_value_t (*jerryx_module_get_canonical_name_t) (const jerry_value_t name);
```
## jerryx_module_resolve_t
**Summary**
Function pointer type for module resolution.
**Prototype**
```c
typedef bool (*jerryx_module_resolve_t) (const jerry_value_t canonical_name,
jerry_value_t *result);
```
## jerryx_module_resolver_t
**Summary**
Structure defining a module resolver.
**Prototype**
```c
typedef struct
{
jerryx_module_get_canonical_name_t get_canonical_name_p;
jerryx_module_resolve_t resolve_p;
} jerryx_module_resolver_t;
```
- `get_canonical_name_p` - function pointer to be called when the canonical name corresponding to the requested name
of a module must be established.
- `resolve_p` - function pointer to be called when a module with the given canonical name needs to be converted to the
`jerry_value_t` that will become the loaded module.
**Example**
```c
static bool
load_and_evaluate_js_file (const jerry_value_t name, jerry_value_t *result)
{
bool return_value = false;
char *js_file_contents = NULL;
int file_size = 0;
jerry_size_t name_size = jerry_string_size (name, JERRY_ENCODING_UTF8);
jerry_char_t name_string[name_size + 1];
jerry_string_to_buffer (name, JERRY_ENCODING_UTF8, name_string, name_size);
name_string[name_size] = 0;
FILE *js_file = fopen (name_string, "r");
if (js_file)
{
/* We have successfully opened the file. Now, we establish its size. */
file_size = fseek (js_file, 0, SEEK_END);
fseek (js_file, 0, SEEK_SET);
/* We allocate enough memory to store the contents of the file. */
js_file_contents = malloc (file_size);
if (js_file_contents)
{
/* We read the file into memory and call jerry_eval (), assigning the result to the out-parameter. */
fread (js_file_contents, file_size, 1, js_file);
(*result) = jerry_eval (js_file_contents, file_size, JERRY_PARSE_NO_OPTS);
/* We release the memory holding the contents of the file. */
free (js_file_contents);
return_value = true;
}
/* We close the file. */
fclose (js_file);
}
return return_value;
}
static jerry_value_t
canonicalize_file_path (const jerry_value_t name)
{
jerry_value_t absolute_path;
/**
* Since a file on the file system can be referred to by multiple relative paths, but only by one absolute path, the
* absolute path becomes the canonical name for the module. Thus, to establish this canonical name, we must search
* name for "./" and "../", follow symlinks, etc., then create absolute_path via jerry_string () and return
* it, because it is the canonical name for this module. Thus, we avoid loading the same JavaScript file twice.
*/
return absolute_path;
}
static jerryx_module_resolver_t js_file_loader
{
canonicalize_file_path,
load_and_evaluate_js_file
};
```
We can now load JavaScript files:
```c
static const jerryx_module_resolver_t *resolvers[] =
{
/*
* Consult the resolver for native JerryScript modules first, in case the requested module is a native JerryScript
* module.
*/
&jerryx_module_native_resolver,
/*
* If the requested module is not a native JerryScript module, assume it is a JavaScript file on disk and use the
* above-defined JavaScript file loader to load it.
*/
&js_file_loader
};
jerry_value_t js_module = jerryx_module_resolve (requested_module, resolvers, 2);
```
# Module helper macros
## JERRYX_NATIVE_MODULE
**Summary**
Helper macro to define a native JerryScript module. Currently declares a global static structure of type
`jerryx_native_module_t` and a constructor/destructor pair that calls `jerryx_native_module_register()` resp.
`jerryx_native_module_unregister()`. If the extension is built without the FEATURE_INIT_FINI flag, indicating that
support for library constructors and destructors is absent, the constructor and destructor are declared as global
symbols so that they may be called explicitly from within the application.
**Note**: The helper macro must appear at the bottom of a source file, and no semicolon must follow it.
**Prototype**
```c
#define JERRYX_NATIVE_MODULE(module_name, on_resolve_cb)
```
- `module_name` - the name of the module without quotes. This value is used as the prefix for the registration and unregistration functions. For example, when `module_name` is `example_module`, this results in the declaration of two functions `example_module_register()` and `example_module_unregister()`. These functions are declared global if support for library constructors/destructors is absent, allowing you to call them from other parts of the code by
first forward-declaring them.
- `on_resolve_cb` - the function of type `jerryx_native_module_on_resolve_t` that will be called when the module needs to be
loaded.
**Example**
```c
#include "jerryscript.h"
#include "jerryscript-ext/module.h"
static jerry_value_t
my_module_on_resolve (void)
{
return jerry_function_external (very_useful_function);
} /* my_module_on_resolve */
/* Note that there is no semicolon at the end of the next line. This is how it must be. */
JERRYX_NATIVE_MODULE (my_module, my_module_on_resolve)
```
**Example Usage When Library Constructors Are Unavailable**
```c
#include "jerryscript.h"
#include "jerryscript-ext/module.h"
/**
* Forward-declare the module registration and unregistration function.
*/
extern void my_module_register (void);
extern void my_module_unregister (void);
int
main (int argc, char **argv)
{
jerryx_module_resolver_t resolvers[] =
{
jerryx_native_module_resolver
};
/* This plays the role of the library constructor. */
my_module_register ();
jerry_init (JERRY_INIT_EMPTY);
...
jerry_value_t my_module = jerryx_module_resolve ("my_module", resolvers, 1);
...
jerry_cleanup ();
/* This plays the role of the library destructor */
my_module_unregister();
return 0;
}
```
+220
View File
@@ -0,0 +1,220 @@
# JerryScript debugger transport interface
The transport interface support allows dynamic selection of transportation
layers which can encode/decode or send/receive messages transmitted between
the debugger client and server.
# Types
## jerry_debugger_transport_receive_context_t
**Summary**
This context represents the current status of processing received data.
The final state is returned by
[jerry_debugger_transport_receive](#jerry_debugger_transport_receive)
and must be passed to
[jerry_debugger_transport_receive_completed](#jerry_debugger_transport_receive_completed)
after the message is processed.
**Prototype**
```c
typedef struct
{
uint8_t *buffer_p; /**< buffer for storing the received data */
size_t received_length; /**< number of currently received bytes */
uint8_t *message_p; /**< start of the received message */
size_t message_length; /**< length of the received message */
size_t message_total_length; /**< total length for datagram protocols,
* 0 for stream protocols */
} jerry_debugger_transport_receive_context_t;
```
## jerry_debugger_transport_header_t
**Summary**
Shared header for each transport interface. It mostly contains callback functions
used by the JerryScript debugger server.
**Prototype**
```c
typedef struct jerry_debugger_transport_layer_t
{
/* The following fields must be filled before calling jerry_debugger_transport_add(). */
jerry_debugger_transport_close_t close; /**< close connection callback */
jerry_debugger_transport_send_t send; /**< send data callback */
jerry_debugger_transport_receive_t receive; /**< receive data callback */
/* The following fields are filled by jerry_debugger_transport_add(). */
struct jerry_debugger_transport_layer_t *next_p; /**< next transport layer */
} jerry_debugger_transport_header_t;
```
## jerry_debugger_transport_close_t
**Summary**
Called when the connection is closed. Must release all resources (including the
memory area for the transport interface) allocated for the transport interface.
**Prototype**
```c
typedef void (*jerry_debugger_transport_close_t) (struct jerry_debugger_transport_interface_t *header_p);
```
## jerry_debugger_transport_send_t
**Summary**
Called when a message needs to be sent. Must either transmit the message or call
the `header_p->next_p->send()` method.
**Prototype**
```c
typedef bool (*jerry_debugger_transport_send_t) (struct jerry_debugger_transport_interface_t *header_p,
uint8_t *message_p,
size_t message_length);
```
## jerry_debugger_transport_receive_t
**Summary**
Called during message processing. If messages are available it must return with
the next message.
**Prototype**
```c
typedef bool (*jerry_debugger_transport_receive_t) (struct jerry_debugger_transport_interface_t *header_p,
jerry_debugger_transport_receive_context_t *context_p);
```
# Transport interface API functions
## jerry_debugger_transport_add
**Summary**
Add a new interface to the transportation interface chain. The interface
will be the first item of the interface chain.
**Prototype**
```c
void jerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p,
size_t send_message_header_size,
size_t max_send_message_size,
size_t receive_message_header_size,
size_t max_receive_message_size);
```
- `header_p`: header of a transportation interface.
- `send_message_header_size`: size of the outgoing message header, can be 0.
- `max_send_message_size`: maximum outgoing message size supported by the interface.
- `receive_message_header_size`: size of the incoming message header, can be 0.
- `max_receive_message_size`: maximum incoming message size supported by the interface.
## jerry_debugger_transport_start
**Summary**
Starts the communication to the debugger client. Must be called after the
connection is successfully established.
**Prototype**
```c
void jerry_debugger_transport_start (void);
```
## jerry_debugger_transport_is_connected
**Summary**
Tells whether a debugger client is connected to the debugger server.
**Prototype**
```c
bool jerry_debugger_transport_is_connected (void);
```
- return value: `true`, if a client is connected, `false` otherwise.
## jerry_debugger_transport_close
**Summary**
Disconnect from the current debugger client. It does nothing if a client is
not connected.
**Prototype**
```c
void jerry_debugger_transport_close (void);
```
## jerry_debugger_transport_send
**Summary**
Send message to the client.
**Prototype**
```c
bool jerry_debugger_transport_send (const uint8_t *message_p, size_t message_length);
```
- `message_p`: message to be sent.
- `message_length`: message length in bytes.
- return value: `true`, if a client is still connected, `false` otherwise.
## jerry_debugger_transport_receive
**Summary**
Receive message from the client.
**Prototype**
```c
bool jerry_debugger_transport_receive (jerry_debugger_transport_receive_context_t *context_p);
```
- `context_p`: an unused [jerry_debugger_transport_receive_context_t](#jerry_debugger_transport_receive_context_t).
- return value: `true`, if a client is still connected, `false` otherwise.
## jerry_debugger_transport_receive_completed
**Summary**
Must be called after [jerry_debugger_transport_receive](#jerry_debugger_transport_receive)
returns with a valid message. Must not be called otherwise.
**Prototype**
```c
void jerry_debugger_transport_receive_completed (jerry_debugger_transport_receive_context_t *context_p);
```
- `context_p`: a [jerry_debugger_transport_receive_context_t](#jerry_debugger_transport_receive_context_t)
passed to [jerry_debugger_transport_receive](#jerry_debugger_transport_receive).
## jerry_debugger_transport_sleep
**Summary**
Can be used to wait for incoming messages. Currently the delay is 100ms.
**Prototype**
```c
void jerry_debugger_transport_sleep (void);
```
+112
View File
@@ -0,0 +1,112 @@
# Handle Scope
## jerryx_handle_scope
**Summary**
It is often necessary to make the lifespan of handles shorter than the lifespan of a native method. Even though the native code could only use the most recent handle, all of the associated objects would also be kept alive since they all share the same scope.
To handle this case, JerryScript HandleScope extension provides the ability to establish a new 'scope' to which newly created handles will be associated. Once those handles are no longer required, the scope can be 'closed' and any handles associated with the scope are invalidated. The methods available to open/close scopes are `jerryx_open_handle_scope` and `jerryx_close_handle_scope`.
JerryScript only supports a single nested hierarchy of scopes. There is only one active scope at any time, and all new handles will be associated with that scope while it is active. Scopes must be closed in the reverse order from which they are opened. In addition, all scopes created within a native method must be closed before returning from that method.
**Example**
[doctest]: # ()
```c
#include "jerryscript.h"
#include "jerryscript-ext/handle-scope.h"
static jerry_value_t
create_object (void)
{
jerry_value_t obj = jerry_object ();
return obj;
} /* create_object */
static void
test_handle_scope_val (void)
{
jerryx_handle_scope scope;
jerryx_open_handle_scope (&scope);
jerry_value_t obj = jerryx_create_handle (create_object ());
jerryx_close_handle_scope (scope);
// now obj has been released
} /* test_handle_scope_val */
int
main (void)
{
jerry_init (JERRY_INIT_EMPTY);
test_handle_scope_val ();
jerry_heap_gc (JERRY_GC_PRESSURE_LOW);
jerry_cleanup ();
} /* main */
```
## jerryx_escapable_handle_scope
**Summary**
It is necessary in common cases that a handle has to be promote to outer scope and prevent from been garbage collected. To handle this case, a escapable handle scope has been proposed from which one object can be promoted to the outer scope. The method available to escape an object from been release at current scope is `jerryx_escape_handle`.
**Example**
[doctest]: # ()
```c
#include "jerryscript.h"
#include "jerryscript-ext/handle-scope.h"
static jerry_value_t
create_object (void)
{
jerryx_escapable_handle_scope scope;
jerryx_open_escapable_handle_scope (&scope);
jerry_value_t obj = jerryx_create_handle (jerry_object ());
jerry_value_t escaped_obj;
jerryx_escape_handle(scope, obj, &escaped_obj);
jerryx_close_handle_scope (scope);
// escaped_obj has now been escaped to outer scope, thus not released at this point
return escaped_obj;
} /* create_object */
static void
test_handle_scope_val (void)
{
jerryx_handle_scope scope;
jerryx_open_handle_scope (&scope);
jerry_value_t obj = create_object ();
jerryx_close_handle_scope (scope);
// now obj has been released
} /* test_handle_scope_val */
int
main (void)
{
jerry_init (JERRY_INIT_EMPTY);
test_handle_scope_val ();
jerry_heap_gc (JERRY_GC_PRESSURE_LOW);
jerry_cleanup ();
} /* main */
```
**See also**
- [jerry_value_t](../docs/02.API-REFERENCE.md#jerry_value_t)
- [jerry_value_copy](../docs/02.API-REFERENCE.md#jerry_value_copy)
- [jerry_value_free](../docs/02.API-REFERENCE.md#jerry_value_free)
## Pre-allocated list of handle scopes and handles
To prevent trapping into system calls frequently, a pre-allocated dedicated list mechanism has been introduced to the implementation of JerryX handle scope.
To change the size of pre-allocation list, use build definition `JERRYX_HANDLE_PRELIST_SIZE` and `JERRYX_SCOPE_PRELIST_SIZE` to alter the default value of 20.
+159
View File
@@ -0,0 +1,159 @@
# ES6 module support for JerryScript
The module system allows users to write import and export statements in scripts, which can be used to separate the logic of the application into custom modules.
The standard's relevant part can be found [here](https://www.ecma-international.org/ecma-262/6.0/#sec-modules).
Embedders wishing to use native builtin modules with ES6 imports can use the [Port API](05.PORT-API.md#jerry-module-system) to do so.
## General
If a script contains import statements, then JerryScript will open and evaluate the the referenced modules before the main script runs, resolving and creating bindings for the referenced identifiers in the process.
It is not necessary to use any specific filename extensions for modules, JerryScript will try to open the given file paths as they are, but will try to normalize them before doing so. The exact normalization process is dependant on the port implementation provided. It is the user's responsibility to verify that the given files are valid ECMAScript modules.
main.js
```js
import { exported_value } from "./module.js"
print (exported_value);
```
module.js
```js
var exported_value = 42;
export exported_value;
```
## Supported features
* exporting identifiers from the module's lexical environment
* specifying export names for the exported values
* importing exported identifiers from a module
* specifying local binding names for the imported values
* module namespace imports
* `import * as module from 'module.js`
* indirect export statements
* `export {variable} from 'module.js'`
* star export statements
* `export * from 'module.js'`
* importing a module for side-effects
* `import 'module.js'`
* default import and export statements
* `export default local_identifier`
* `import def from 'module.js'`
* anonymous default exports
* `export default function () {}`
### Example
```js
import {
engine,
version as v
} from "./module.js"
import { getFeatureDetails } from "./module_2.js"
var version = "v3.1415";
print("> main.js");
print(">> Engine: " + engine);
print(">> Version: " + v);
print (">> " + getFeatureDetails());
print (">> Script version: " + version);
```
```js
// module.js
var _engine = "JerryScript";
export _engine as engine;
export var version = "1.0 (e92ae0fb)";
```
```js
// module_2.js
var featureName = "ECMAScript modules";
var year = 2018;
export function getFeatureDetails() {
return "Feature name: " + featureName + " | developed in " + year;
}
```
### Module namespace import statements
A module namespace object can be imported. In this case the local binding will contain an object holding the exported values of the module, including local exports and all indirect exports. Ambiguous exported names are excluded from the namespace object.
```js
import * as module from './module.js';
print(">> Engine: " + module.engine);
print(">> Version: " + module.version);
```
### Indirect export statements
An export statement can transitively export variables from another module, either via named indirect exports or a star export statement. In this case the resolving process will follow the chain until it reaches a module containing a local binding for that export name. If there are multiple modules which satisfy the export, that means the export is ambiguous, and will result in a SyntaxError.
```js
import { a, b } from 'module.js'
print (a + b);
```
```js
// module.js
export var a = 2;
export { b } from 'module2.js'
```
```js
// module2.js
export var b = 40;
```
### Default imports and exports
Each module can optionally provide a single default export by using the `export default` statement. Default exports can either reference identifiers in the module's lexical environment, or be an anonymous default export, in which case they will only be accessible by an importing script.
```js
import defaultExport, { b as c } from 'module.js'
print (defaultExport); // 2
print (c ()); // 42
```
```js
// module.js
export default 2;
export function b () {
return 42;
}
```
### Importing modules for side-effects
Evaluate a module without importing anything. Any errors encountered in the module will be propagated.
```js
import 'module.js' // > module.js
// "> module.js" is printed
b (); // (ReferenceError) b is not defined
```
```js
// module.js
export function b () {
print ("> module.js");
return 42;
}
b ();
```
## Unsupported features
* **snapshot**
+781
View File
@@ -0,0 +1,781 @@
# Migration guide
This guide intends to describe the major changes between the JerryScript 1.0 and 2.0 versions.
In addition it is designed to provide a guide on how to modify the 1.0 version code to a
2.0 compliant code.
During the development it was important to minimize the changes in the API functions and types.
Each API method removal or change is described below providing a ***before*** and ***after***
code example.
For more information on the current API methods please check the [API reference](02.API-REFERENCE.md) document.
# Short list of removed/renamed headers, types, functions, and macros
***Removed legacy headers***
- `jerry-internal.h`
***Renamed headers***
- `jerry-api.h` to `jerryscript.h`
- `jerry-port.h` to `jerryscript-port.h`
***Removed API types***
- `jerry_char_ptr_t` usage replaced with `jerry_char_t *`
- `jerry_object_free_callback_t` replaced by `jerry_object_native_free_callback_t`
***Removed API methods***
- `jerry_get_memory_limits`
- `jerry_get_object_native_handle` replaced by `jerry_get_object_native_pointer`
- `jerry_set_object_native_handle` replaced by `jerry_set_object_native_pointer`
- `jerry_value_set_abort_flag` replaced by `jerry_create_abort_from_value`
- `jerry_value_has_abort_flag` replaced by `jerry_value_is_abort`
- `jerry_value_set_error_flag` replaced by `jerry_create_error_from_value`
- `jerry_value_has_error_flag` replaced by `jerry_value_is_error`
- `jerry_value_clear_error_flag` replaced by `jerry_get_value_from_error`
- `jerry_get_value_without_error_flag` replaced by `jerry_get_value_from_error`
- `jerry_parse_and_save_snapshot` replaced by `jerry_generate_snapshot`
- `jerry_parse_and_save_function_snapshot` replaced by `jerry_generate_function_snapshot`
***Removed unused configuration macros***
- `CONFIG_MEM_DATA_LIMIT_MINUS_HEAP_SIZE`
- `CONFIG_MEM_STACK_LIMIT`
- `CONFIG_VM_STACK_FRAME_INLINED_VALUES_NUMBER`
- `CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE`
- All `CONFIG_..` macros have been renamed to use the `JERRY_` prefix format.
# Modified API functions
## Error manipulating functions
The most important changes in the API are related to error handling and manipulation.
### jerry_value_set_abort_flag
This function was replaced with [`jerry_create_abort_from_value`](02.API-REFERENCE.md#jerry_create_abort_from_value).
Take note of the second argument of the new `jerry_create_abort_from_value` function which controls if the
first argument should be usable after the call or not.
**Before**
```c
{
jerry_value_t value;
// create or acquire value
// ...
jerry_value_set_abort_flag (&value);
jerry_release_value (value);
}
```
**After**
```c
{
jerry_value_t value;
// create or acquire value
// ...
jerry_value_t abort = jerry_create_abort_from_value (value, true);
// using the 'value' variable after release is invalid
jerry_release_value (abort);
}
```
- OR
```c
{
jerry_value_t value;
... // create or acquire value
jerry_value_t abort = jerry_create_abort_from_value (value, false);
// both 'abort' and 'value' can be used and must be released when they are no longer needed
jerry_release_value (abort);
jerry_release_value (value);
}
```
### jerry_value_has_abort_flag
This function was renamed to [`jerry_value_is_abort`](02.API-REFERENCE.md#jerry_value_is_abort).
**Before**
```c
{
jerry_value_t value;
// create or acquire value
// ...
if (jerry_value_has_abort_flag (value))
{
// ...
}
jerry_release_value (value);
}
```
**After**
```c
{
jerry_value_t value;
// create or acquire value
// ...
if (jerry_value_is_abort (value))
{
// ...
}
jerry_release_value (value);
}
```
### jerry_value_set_error_flag
This function was replaced with [`jerry_create_error_from_value`](02.API-REFERENCE.md#jerry_create_error_from_value).
Take note of the second argument of the new `jerry_create_error_from_value` function which controls if the
first argument should be usable after the call or not.
**Before**
```c
{
jerry_value_t value;
// create or acquire value
// ...
jerry_value_set_error_flag (&value);
jerry_release_value (value);
}
```
**After**
```c
{
jerry_value_t value;
// create or acquire value
// ...
jerry_value_t error = jerry_create_error_from_value (value, true);
// using the 'value' variable after release is invalid
jerry_release_value (error);
}
```
- OR
```c
{
jerry_value_t value;
// create or acquire value
// ...
jerry_value_t error = jerry_create_error_from_value (value, false);
// both 'error' and 'value' can be used and must be released when they are no longer needed
jerry_release_value (error);
jerry_release_value (value);
}
```
### jerry_value_has_error_flag
This function was renamed to [`jerry_value_is_error`](02.API-REFERENCE.md#jerry_value_is_error).
**Before**
```c
{
jerry_value_t value;
// create or acquire value
// ...
if (jerry_value_has_error_flag (value))
{
// ...
}
jerry_release_value (value);
}
```
**After**
```c
{
jerry_value_t value;
// create or acquire value
// ...
if (jerry_value_is_error (value))
{
// ...
}
jerry_release_value (value);
}
```
### jerry_value_clear_error_flag AND jerry_get_value_without_error_flag
These functions were merged into [`jerry_get_value_from_error`](02.API-REFERENCE.md#jerry_get_value_from_error).
Please note the second argument of the new function which controls if the first argument passed should be released
or not.
**Before**
```c
{
jerry_value_t value;
// create or acquire value
// ...
jerry_value_set_error_flag (&value);
jerry_value_clear_error_flag (&value);
// or
jerry_value_t real_value = jerry_get_value_without_error_flag (value);
jerry_release_value (value);
jerry_release_value (real_value);
}
```
**After**
```c
{
jerry_value_t value;
// create or acquire value
// ...
jerry_value_t error = jerry_create_error_from_value (value, true);
jerry_value_t real_value = jerry_get_value_from_error (error, true);
jerry_release_value (real_value);
}
```
## Other functions changed
### jerry_register_magic_strings
In case of the `jerry_register_magic_strings` function the change is that
the first argument's base type `jerry_char_ptr_t` was changed to `jerry_char_t*`.
For more details see: [`jerry_register_magic_strings`](02.API-REFERENCE.md#jerry_register_magic_strings).
In the following code parts please take note of the type used for the `magic_string_items` array.
**Before**
```c
{
// must be static, because 'jerry_register_magic_strings' does not copy
// the items must be sorted by size at first, then lexicographically
static const jerry_char_ptr_t magic_string_items[] = {
(const jerry_char_ptr_t) "magicstring1",
(const jerry_char_ptr_t) "magicstring2",
(const jerry_char_ptr_t) "magicstring3"
};
uint32_t num_magic_string_items = (uint32_t) (sizeof (magic_string_items) / sizeof (jerry_char_ptr_t));
// must be static, because 'jerry_register_magic_strings' does not copy
static const jerry_length_t magic_string_lengths[] = { 12, 12, 12 };
jerry_register_magic_strings (magic_string_items, num_magic_string_items, magic_string_lengths);
}
```
**After**
```c
{
// must be static, because 'jerry_register_magic_strings' does not copy
// the items must be sorted by size at first, then lexicographically
static const jerry_char_t *magic_string_items[] = {
(const jerry_char_t *) "magicstring1",
(const jerry_char_t *) "magicstring2",
(const jerry_char_t *) "magicstring3"
};
uint32_t num_magic_string_items = (uint32_t) (sizeof (magic_string_items) / sizeof (jerry_char_t *));
// must be static, because 'jerry_register_magic_strings' does not copy
static const jerry_length_t magic_string_lengths[] = { 12, 12, 12 };
jerry_register_magic_strings (magic_string_items, num_magic_string_items, magic_string_lengths);
}
```
## Snapshot generating API
### jerry_parse_and_save_snapshot
This function was replaced with [`jerry_generate_snapshot`](02.API-REFERENCE.md#jerry_generate_snapshot).
The function returns an error object if there was any problem during snapshot generation and
if there was no problem the return value is a number value containing the snapshot size in bytes.
**Before**
```c
{
static uint32_t global_mode_snapshot_buffer[256];
const jerry_char_t *code_to_snapshot_p = (const jerry_char_t *) "(function () { return 'string from snapshot'; }) ();";
size_t global_mode_snapshot_size =
jerry_parse_and_save_snapshot (code_to_snapshot_p,
strlen ((const char *) code_to_snapshot_p),
true,
false,
global_mode_snapshot_buffer,
sizeof (global_mode_snapshot_buffer) / sizeof (uint32_t));
// use "global_mode_snapshot_buffer"
}
```
**After**
```c
{
static uint32_t global_mode_snapshot_buffer[256];
const jerry_char_t *code_to_snapshot_p = (const jerry_char_t *) "(function () { return 'string from snapshot'; }) ();";
jerry_value_t generate_result;
generate_result = jerry_generate_snapshot (NULL,
0,
code_to_snapshot_p,
strlen ((const char *) code_to_snapshot_p),
global_mode_snapshot_buffer,
sizeof (global_mode_snapshot_buffer) / sizeof (uint32_t));
if (jerry_value_is_error (generate_result))
{
// There was a problem during snapshot generation, for example there is a SyntaxError.
// Use the "generate_result" to check the error.
}
else
{
size_t snapshot_size = (size_t) jerry_get_number_value (generate_result);
// use "global_mode_snapshot_buffer"
}
jerry_release_value (generate_result);
}
```
### jerry_parse_and_save_function_snapshot
This function was replaced with [`jerry_generate_function_snapshot`](02.API-REFERENCE.md#jerry_parse_and_save_function_snapshot).
The function returns an error object if there was any problem during snapshot generation and
if there was no problem the return value is a number value containing the snapshot size in bytes.
**Before**
```c
{
static uint32_t func_snapshot_buffer[1024];
const jerry_char_t *args_p = (const jerry_char_t *) "a, b";
const jerry_char_t *src_p = (const jerry_char_t *) "return a + b;";
size_t func_snapshot_size =
jerry_parse_and_save_function_snapshot (src_p,
strlen ((const char *) src_p),
args_p,
strlen ((const char *) args_p),
false,
func_snapshot_buffer,
sizeof (func_snapshot_buffer) / sizeof (uint32_t));
// check "function_snapshot_size" and use "func_snapshot_buffer"
}
```
**After**
```c
{
static uint32_t func_snapshot_buffer[1024];
const jerry_char_t *args_p = (const jerry_char_t *) "a, b";
const jerry_char_t *src_p = (const jerry_char_t *) "return a + b;";
jerry_value_t generate_result;
generate_result = jerry_generate_function_snapshot (NULL,
0,
src_p,
strlen ((const char *) src_p),
args_p,
strlen ((const char *) args_p),
0,
func_snapshot_buffer,
sizeof (func_snapshot_buffer) / sizeof (uint32_t));
if (jerry_value_is_error (generate_result))
{
// There was a problem during snapshot generation, for example there is a SyntaxError.
// Use the "generate_result" to check the error.
}
else
{
size_t snapshot_size = (size_t) jerry_get_number_value (generate_result);
// use "func_snapshot_buffer"
}
jerry_release_value (generate_result)
}
```
## Garbage collection
### jerry_gc
The [`jerry_gc`](02.API-REFERENCE.md#jerry_gc) function was modified to handle an argument which represents the pressure for the garbage collector.
For more information checkout the [`jerry_gc_mode_t`](02.API-REFERENCE.md#jerry_gc_mode_t) reference.
**Before**
```c
{
jerry_gc ();
}
```
**After**
```c
{
jerry_gc (JERRY_GC_PRESSURE_LOW);
}
```
## jerry_eval
The third argument of [`jerry_eval`](02.API-REFERENCE.md#jerry_eval) has been changed
from `bool` to [`jerry_parse_opts_t`](02.API-REFERENCE.md#jerry_parse_opts_t).
**Before**
```c
const jerry_char_t *str_to_eval = (const jerry_char_t *) "1 + 1";
jerry_value_t ret_val = jerry_eval (str_to_eval,
strlen ((const char *) str_to_eval),
false);
```
**After**
```c
const jerry_char_t *str_to_eval = (const jerry_char_t *) "1 + 1";
jerry_value_t ret_val = jerry_eval (str_to_eval,
strlen ((const char *) str_to_eval),
JERRY_PARSE_NO_OPTS);
```
## Port API
### jerry_port_get_time_zone
The port API of handling timezones has been changed. The previous interface did not
allow timezones to be handled correctly, even if the host system was up to the task.
Check [the related issue](https://github.com/jerryscript-project/jerryscript/issues/1661)
for more details.
The new port API function name is [jerry_port_get_local_time_zone_adjustment](05.PORT-API.md#date-1].
Below is the default implementations for both versions:
**Before**
```c
bool jerry_port_get_time_zone (jerry_time_zone_t *tz_p)
{
struct timeval tv;
struct timezone tz;
/* gettimeofday may not fill tz, so zero-initializing */
tz.tz_minuteswest = 0;
tz.tz_dsttime = 0;
if (gettimeofday (&tv, &tz) != 0)
{
return false;
}
tz_p->offset = tz.tz_minuteswest;
tz_p->daylight_saving_time = tz.tz_dsttime > 0 ? 1 : 0;
return true;
} /* jerry_port_get_time_zone */
```
**After**
```c
double jerry_port_get_local_time_zone_adjustment (double unix_ms,
bool is_utc)
{
struct tm tm;
time_t now = (time_t) (unix_ms / 1000);
localtime_r (&now, &tm);
if (!is_utc)
{
now -= tm.tm_gmtoff;
localtime_r (&now, &tm);
}
return ((double) tm.tm_gmtoff) * 1000;
} /* jerry_port_get_local_time_zone_adjustment */
```
## Native pointers
The assignment of native pointers (previously called handles) have been changed
since v1.0. In the previous version only one native pointer could be assigned to
a `jerry_value_t`. Now it is allowed to register multiple native infos, which
can be accessed with the corresponding
[`jerry_object_native_info_t`](02.API-REFERENCE.md#jerry_object_native_info_t).
The old functions were removed and replaced by new ones.
- `jerry_object_free_callback_t` callback type is replaced by `jerry_object_native_info_t`
- `jerry_get_object_native_handle` is replaced by [`jerry_get_object_native_pointer`](02.API-REFERENCE.md#jerry_get_object_native_pointer)
- `jerry_set_object_native_handle` is replaced by [`jerry_set_object_native_pointer`](02.API-REFERENCE.md#jerry_set_object_native_pointer)
**Before**
```c
struct
{
int data;
} my_info;
static void
handler_construct_freecb (uintptr_t native_p)
{
// Invoked when the JS object is released and the
// native data should be freed.
struct my_info *info = (struct my_info *) native_p;
free (info);
}
void
demo (void)
{
jerry_value_t this_val;
// create or acquire this_val
// ...
struct my_info *info = (struct my_info *) malloc (sizeof (struct my_info));
info->data = 11;
// setting the native handle
jerry_set_object_native_handle (this_val,
(uintptr_t) info,
handler_construct_freecb);
// ...
// reading back the native handle
uintptr_t ptr = (uintptr_t) NULL;
bool is_ok = jerry_get_object_native_handle (this_val, &ptr);
if (is_ok)
{
struct my_info *obj_info = (struct my_info *) ptr;
// use "obj_info"
}
}
```
**After**
```c
struct
{
int data;
} my_info;
static void
handler_construct_freecb (void *native_p)
{
// Invoked when the JS object is released and the
// native data should be freed.
struct my_info *info = (struct my_info *) native_p;
free (info);
}
static const jerry_object_native_info_t my_info_type_info =
{
.free_cb = handler_construct_freecb
};
void
demo (void)
{
jerry_value_t this_val;
// create or acquire this_val
// ...
struct my_info *info = (struct my_info *) malloc (sizeof (struct my_info));
info->data = 11;
// setting the native handle
jerry_set_object_native_pointer (this_val,
info,
&my_info_type_info);
// ...
// reading back the native handle pointed by the "my_info_type_info" variable
void *ptr = NULL;
bool has_p = jerry_get_object_native_pointer (this_val, &ptr, &my_info_type_info);
if (has_p)
{
struct my_info *obj_info = (struct my_info *) ptr;
// use "obj_info"
}
}
```
# New API functions
In this section the new API functions are listed.
## Built-in objects
***ArrayBuffer***
- [`jerry_create_arraybuffer`](02.API-REFERENCE.md#jerry_create_arraybuffer)
- [`jerry_create_arraybuffer_external`](02.API-REFERENCE.md#jerry_create_arraybuffer_external)
- [`jerry_get_arraybuffer_pointer`](02.API-REFERENCE.md#jerry_get_arraybuffer_pointer)
***DataView***
- [`jerry_create_dataview`](02.API-REFERENCE.md#jerry_create_dataview)
- [`jerry_value_is_dataview`](02.API-REFERENCE.md#jerry_value_is_dataview)
- [`jerry_get_dataview_buffer`](02.API-REFERENCE.md#jerry_get_dataview_buffer)
***JSON***
- [`jerry_json_parse`](02.API-REFERENCE.md#jerry_json_parse)
- [`jerry_json_stringify`](02.API-REFERENCE.md#jerry_json_stringify)
***Number***
- [`jerry_create_number_infinity`](02.API-REFERENCE.md#jerry_create_number_infinity)
- [`jerry_create_number_nan`](02.API-REFERENCE.md#jerry_create_number_nan)
***Promise***
- [`jerry_run_all_enqueued_jobs`](02.API-REFERENCE.md#jerry_run_all_enqueued_jobs)
- [`jerry_create_promise`](02.API-REFERENCE.md#jerry_create_promise)
- [`jerry_resolve_or_reject_promise`](02.API-REFERENCE.md#jerry_resolve_or_reject_promise)
- [`jerry_value_is_promise`](02.API-REFERENCE.md#jerry_value_is_promise)
***RegExp***
- [`jerry_create_regexp`](02.API-REFERENCE.md#jerry_create_regexp)
- [`jerry_create_regexp_sz`](02.API-REFERENCE.md#jerry_create_regexp_sz)
***String***
- [`jerry_substring_to_utf8_char_buffer`](02.API-REFERENCE.md#jerry_substring_to_utf8_char_buffer)
- [`jerry_get_utf8_string_size`](02.API-REFERENCE.md#jerry_get_utf8_string_size)
- [`jerry_get_utf8_string_length`](02.API-REFERENCE.md#jerry_get_utf8_string_length)
- [`jerry_create_string_from_utf8`](02.API-REFERENCE.md#jerry_create_string_from_utf8)
- [`jerry_create_string_sz_from_utf8`](02.API-REFERENCE.md#jerry_create_string_sz_from_utf8)
***Symbol***
- [`jerry_create_symbol`](02.API-REFERENCE.md#jerry_create_symbol)
- [`jerry_get_symbol_descriptive_string`](02.API-REFERENCE.md#jerry_get_symbol_descriptive_string)
- [`jerry_value_is_symbol`](02.API-REFERENCE.md#jerry_value_is_symbol)
***TypedArray***
- [`jerry_create_typedarray`](02.API-REFERENCE.md#jerry_create_typedarray)
- [`jerry_create_typedarray_for_arraybuffer`](02.API-REFERENCE.md#jerry_create_typedarray_for_arraybuffer)
- [`jerry_create_typedarray_for_arraybuffer_sz`](02.API-REFERENCE.md#jerry_create_typedarray_for_arraybuffer_sz)
- [`jerry_get_typedarray_type`](02.API-REFERENCE.md#jerry_get_typedarray_type)
- [`jerry_get_typedarray_length`](02.API-REFERENCE.md#jerry_get_typedarray_length)
- [`jerry_get_typedarray_buffer`](02.API-REFERENCE.md#jerry_get_typedarray_buffer)
- [`jerry_value_is_typedarray`](02.API-REFERENCE.md#jerry_value_is_typedarray)
## Instances and memory management
***JerryScript instances***
- [`jerry_create_context`](02.API-REFERENCE.md#jerry_create_context)
- [`jerry_get_context_data`](02.API-REFERENCE.md#jerry_get_context_data)
***Memory management***
- [`jerry_heap_alloc`](02.API-REFERENCE.md#jerry_heap_alloc)
- [`jerry_heap_free`](02.API-REFERENCE.md#jerry_heap_free)
## Operations with JavaScript values
***Binary operations***
- [`jerry_binary_operation`](02.API-REFERENCE.md#jerry_binary_operation)
***Error manipulating***
- [`jerry_get_error_type`](02.API-REFERENCE.md#jerry_get_error_type)
- [`jerry_get_backtrace`](02.API-REFERENCE.md#jerry_get_backtrace)
***Native pointers***
- [`jerry_delete_object_native_pointer`](02.API-REFERENCE.md#jerry_delete_object_native_pointer)
- [`jerry_objects_foreach_by_native_info`](02.API-REFERENCE.md#jerry_objects_foreach_by_native_info)
***Property***
- [`jerry_delete_property_by_index`](02.API-REFERENCE.md#jerry_delete_property_by_index)
- [`jerry_objects_foreach`](02.API-REFERENCE.md#jerry_objects_foreach)
## Debugger
- [`jerry_debugger_is_connected`](07.DEBUGGER.md#jerry_debugger_is_connected)
- [`jerry_debugger_stop`](07.DEBUGGER.md#jerry_debugger_stop)
- [`jerry_debugger_continue`](07.DEBUGGER.md#jerry_debugger_continue)
- [`jerry_debugger_stop_at_breakpoint`](07.DEBUGGER.md#jerry_debugger_stop_at_breakpoint)
- [`jerry_debugger_wait_for_client_source`](07.DEBUGGER.md#jerry_debugger_wait_for_client_source)
- [`jerry_debugger_send_output`](07.DEBUGGER.md#jerry_debugger_send_output)
- [`jerry_debugger_send_log`](07.DEBUGGER.md#jerry_debugger_send_log)
## Other
- [`jerry_is_feature_enabled`](02.API-REFERENCE.md#jerry_is_feature_enabled)
- [`jerry_parse_and_save_literals`](02.API-REFERENCE.md#jerry_parse_and_save_literals)
- [`jerry_set_vm_exec_stop_callback`](02.API-REFERENCE.md#jerry_set_vm_exec_stop_callback)
## Port API functions
- [`jerry_port_normalize_path`](05.PORT-API.md#jerry_port_normalize_path)
- [`jerry_port_read_source`](05.PORT-API.md#jerry_port_read_source)
- [`jerry_port_release_source`](05.PORT-API.md#jerry_port_release_source)
- [`jerry_port_print_char`](05.PORT-API.md#jerry_port_print_char)
- [`jerry_port_get_current_context`](05.PORT-API.md#jerry_port_get_current_context)
- [`jerry_port_fatal`](05.PORT-API.md#jerry_port_fatal)
- [`jerry_port_sleep`](05.PORT-API.md#jerry_port_sleep)
- [`jerry_port_print_byte`](05.PORT-API.md#jerry_port_print_byte)
# Migrating from 2.x to 3.x
The most significant change in JerryScript 3.0 was the API rework. Most of the API functions had been
renamed in this version. There are notes for every such function in the [API Reference](02.API-REFERENCE.md)
to help you to migrate from an older version. For example:
*Renamed in version 3.0, it was previously known as `jerry_get_global_object` in earlier versions.*
Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

+719 -163
View File
@@ -1,5 +1,4 @@
# Copyright 2015-2016 Samsung Electronics Co., Ltd.
# Copyright 2016 University of Szeged.
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -13,41 +12,108 @@
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required (VERSION 2.8.12)
cmake_minimum_required (VERSION 3.10)
set(JERRY_CORE_NAME jerry-core)
project (${JERRY_CORE_NAME} C)
include(CheckLibraryExists)
# Optional features
set(FEATURE_PROFILE "full" CACHE STRING "Profile types: full, minimal")
set(FEATURE_ERROR_MESSAGES OFF CACHE BOOL "Enable error messages?")
set(FEATURE_VALGRIND OFF CACHE BOOL "Enable Valgrind support?")
set(FEATURE_VALGRIND_FREYA OFF CACHE BOOL "Enable Valgrind-Freya support?")
set(FEATURE_MEM_STRESS_TEST OFF CACHE BOOL "Enable mem-stress test?")
set(FEATURE_MEM_STATS OFF CACHE BOOL "Enable memory statistics?")
set(FEATURE_PARSER_DUMP OFF CACHE BOOL "Enable parser byte-code dumps?")
set(FEATURE_REGEXP_DUMP OFF CACHE BOOL "Enable regexp byte-code dumps?")
set(FEATURE_SNAPSHOT_SAVE OFF CACHE BOOL "Allow to save snapshot files?")
set(FEATURE_SNAPSHOT_EXEC OFF CACHE BOOL "Allow to execute snapshot files?")
set(MEM_HEAP_SIZE_KB "512" CACHE STRING "Size of memory heap, in kilobytes")
set(JERRY_CPOINTER_32_BIT OFF CACHE BOOL "Enable 32 bit compressed pointers?")
set(JERRY_DEBUGGER OFF CACHE BOOL "Enable JerryScript debugger?")
set(JERRY_ERROR_MESSAGES OFF CACHE BOOL "Enable error messages?")
set(JERRY_EXTERNAL_CONTEXT OFF CACHE BOOL "Enable external context?")
set(JERRY_PARSER ON CACHE BOOL "Enable javascript-parser?")
set(JERRY_FUNCTION_TO_STRING OFF CACHE BOOL "Enable function toString operation?")
set(JERRY_LINE_INFO OFF CACHE BOOL "Enable line info?")
set(JERRY_LOGGING OFF CACHE BOOL "Enable logging?")
set(JERRY_MEM_STATS OFF CACHE BOOL "Enable memory statistics?")
set(JERRY_MEM_GC_BEFORE_EACH_ALLOC OFF CACHE BOOL "Enable mem-stress test?")
set(JERRY_PARSER_DUMP_BYTE_CODE OFF CACHE BOOL "Enable parser byte-code dumps?")
set(JERRY_PROFILE "es.next" CACHE STRING "Use default or other profile?")
set(JERRY_PROMISE_CALLBACK OFF CACHE BOOL "Enable Promise callbacks?")
set(JERRY_REGEXP_STRICT_MODE OFF CACHE BOOL "Enable regexp strict mode?")
set(JERRY_REGEXP_DUMP_BYTE_CODE OFF CACHE BOOL "Enable regexp byte-code dumps?")
set(JERRY_SNAPSHOT_EXEC OFF CACHE BOOL "Enable executing snapshot files?")
set(JERRY_SNAPSHOT_SAVE OFF CACHE BOOL "Enable saving snapshot files?")
set(JERRY_SYSTEM_ALLOCATOR OFF CACHE BOOL "Enable system allocator?")
set(JERRY_VALGRIND OFF CACHE BOOL "Enable Valgrind support?")
set(JERRY_VM_HALT OFF CACHE BOOL "Enable VM execution stop callback?")
set(JERRY_VM_THROW OFF CACHE BOOL "Enable VM throw callback?")
set(JERRY_GLOBAL_HEAP_SIZE "(512)" CACHE STRING "Size of memory heap, in kilobytes")
set(JERRY_GC_LIMIT "(0)" CACHE STRING "Heap usage limit to trigger garbage collection")
set(JERRY_STACK_LIMIT "(0)" CACHE STRING "Maximum stack usage size, in kilobytes")
set(JERRY_GC_MARK_LIMIT "(8)" CACHE STRING "Maximum depth of recursion during GC mark phase")
# Option overrides
if(JERRY_SYSTEM_ALLOCATOR)
set(JERRY_CPOINTER_32_BIT ON)
set(JERRY_CPOINTER_32_BIT_MESSAGE " (FORCED BY SYSTEM ALLOCATOR)")
endif()
if (JERRY_GLOBAL_HEAP_SIZE GREATER 512)
set(JERRY_CPOINTER_32_BIT ON)
set(JERRY_CPOINTER_32_BIT_MESSAGE " (FORCED BY HEAP SIZE)")
endif()
if(NOT JERRY_PARSER)
set(JERRY_SNAPSHOT_EXEC ON)
set(JERRY_PARSER_DUMP OFF)
set(JERRY_SNAPSHOT_EXEC_MESSAGE " (FORCED BY DISABLED JS PARSER)")
set(JERRY_PARSER_DUMP_MESSAGE " (FORCED BY DISABLED JS PARSER)")
endif()
if(JERRY_CMDLINE_SNAPSHOT)
set(JERRY_SNAPSHOT_SAVE ON)
set(JERRY_SNAPSHOT_SAVE_MESSAGE " (FORCED BY SNAPSHOT TOOL)")
endif()
if(JERRY_MEM_STATS OR JERRY_PARSER_DUMP_BYTE_CODE OR JERRY_REGEXP_DUMP_BYTE_CODE)
set(JERRY_LOGGING ON)
set(JERRYRE_LOGGING_MESSAGE " (FORCED BY STATS OR DUMP)")
endif()
# Status messages
message(STATUS "FEATURE_PROFILE " ${FEATURE_PROFILE})
message(STATUS "FEATURE_ERROR_MESSAGES " ${FEATURE_ERROR_MESSAGES})
message(STATUS "FEATURE_VALGRIND " ${FEATURE_VALGRIND})
message(STATUS "FEATURE_VALGRIND_FREYA " ${FEATURE_VALGRIND_FREYA})
message(STATUS "FEATURE_MEM_STRESS_TEST " ${FEATURE_MEM_STRESS_TEST})
message(STATUS "FEATURE_MEM_STATS " ${FEATURE_MEM_STATS})
message(STATUS "FEATURE_PARSER_DUMP " ${FEATURE_PARSER_DUMP})
message(STATUS "FEATURE_REGEXP_DUMP " ${FEATURE_REGEXP_DUMP})
message(STATUS "FEATURE_SNAPSHOT_SAVE " ${FEATURE_SNAPSHOT_SAVE})
message(STATUS "FEATURE_SNAPSHOT_EXEC " ${FEATURE_SNAPSHOT_EXEC})
message(STATUS "MEM_HEAP_SIZE_KB " ${MEM_HEAP_SIZE_KB})
message(STATUS "JERRY_CPOINTER_32_BIT " ${JERRY_CPOINTER_32_BIT} ${JERRY_CPOINTER_32_BIT_MESSAGE})
message(STATUS "JERRY_DEBUGGER " ${JERRY_DEBUGGER})
message(STATUS "JERRY_ERROR_MESSAGES " ${JERRY_ERROR_MESSAGES})
message(STATUS "JERRY_EXTERNAL_CONTEXT " ${JERRY_EXTERNAL_CONTEXT})
message(STATUS "JERRY_PARSER " ${JERRY_PARSER})
message(STATUS "JERRY_FUNCTION_TO_STRING " ${JERRY_FUNCTION_TO_STRING})
message(STATUS "JERRY_LINE_INFO " ${JERRY_LINE_INFO})
message(STATUS "JERRY_LOGGING " ${JERRY_LOGGING} ${JERRY_LOGGING_MESSAGE})
message(STATUS "JERRY_MEM_STATS " ${JERRY_MEM_STATS})
message(STATUS "JERRY_MEM_GC_BEFORE_EACH_ALLOC " ${JERRY_MEM_GC_BEFORE_EACH_ALLOC})
message(STATUS "JERRY_PARSER_DUMP_BYTE_CODE " ${JERRY_PARSER_DUMP_BYTE_CODE} ${JERRY_PARSER_DUMP_MESSAGE})
message(STATUS "JERRY_PROFILE " ${JERRY_PROFILE})
message(STATUS "JERRY_PROMISE_CALLBACK " ${JERRY_PROMISE_CALLBACK})
message(STATUS "JERRY_REGEXP_STRICT_MODE " ${JERRY_REGEXP_STRICT_MODE})
message(STATUS "JERRY_REGEXP_DUMP_BYTE_CODE " ${JERRY_REGEXP_DUMP_BYTE_CODE})
message(STATUS "JERRY_SNAPSHOT_EXEC " ${JERRY_SNAPSHOT_EXEC} ${JERRY_SNAPSHOT_EXEC_MESSAGE})
message(STATUS "JERRY_SNAPSHOT_SAVE " ${JERRY_SNAPSHOT_SAVE} ${JERRY_SNAPSHOT_SAVE_MESSAGE})
message(STATUS "JERRY_SYSTEM_ALLOCATOR " ${JERRY_SYSTEM_ALLOCATOR})
message(STATUS "JERRY_VALGRIND " ${JERRY_VALGRIND})
message(STATUS "JERRY_VM_HALT " ${JERRY_VM_HALT})
message(STATUS "JERRY_VM_THROW " ${JERRY_VM_THROW})
message(STATUS "JERRY_GLOBAL_HEAP_SIZE " ${JERRY_GLOBAL_HEAP_SIZE})
message(STATUS "JERRY_GC_LIMIT " ${JERRY_GC_LIMIT})
message(STATUS "JERRY_STACK_LIMIT " ${JERRY_STACK_LIMIT})
message(STATUS "JERRY_GC_MARK_LIMIT " ${JERRY_GC_MARK_LIMIT})
# Include directories
set(INCLUDE_CORE
set(INCLUDE_CORE_PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(INCLUDE_CORE_PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}/api"
"${CMAKE_CURRENT_SOURCE_DIR}/debugger"
"${CMAKE_CURRENT_SOURCE_DIR}/ecma/base"
"${CMAKE_CURRENT_SOURCE_DIR}/ecma/builtin-objects"
"${CMAKE_CURRENT_SOURCE_DIR}/ecma/builtin-objects/typedarray"
"${CMAKE_CURRENT_SOURCE_DIR}/ecma/operations"
"${CMAKE_CURRENT_SOURCE_DIR}/jcontext"
"${CMAKE_CURRENT_SOURCE_DIR}/jmem"
@@ -57,173 +123,663 @@ set(INCLUDE_CORE
"${CMAKE_CURRENT_SOURCE_DIR}/parser/regexp"
"${CMAKE_CURRENT_SOURCE_DIR}/vm")
# Sources
# Jerry core
file(GLOB SOURCE_CORE_API *.c)
file(GLOB SOURCE_CORE_ECMA_BASE ecma/base/*.c)
file(GLOB SOURCE_CORE_ECMA_BUILTINS ecma/builtin-objects/*.c)
file(GLOB SOURCE_CORE_ECMA_OPERATIONS ecma/operations/*.c)
file(GLOB SOURCE_CORE_JCONTEXT jcontext/*.c)
file(GLOB SOURCE_CORE_JMEM jmem/*.c)
file(GLOB SOURCE_CORE_JRT jrt/*.c)
file(GLOB SOURCE_CORE_LIT lit/*.c)
file(GLOB SOURCE_CORE_PARSER_JS parser/js/*.c)
file(GLOB SOURCE_CORE_PARSER_REGEXP parser/regexp/*.c)
file(GLOB SOURCE_CORE_VM vm/*.c)
set(SOURCE_CORE_FILES
${SOURCE_CORE_API}
${SOURCE_CORE_ECMA_BASE}
${SOURCE_CORE_ECMA_BUILTINS}
${SOURCE_CORE_ECMA_OPERATIONS}
${SOURCE_CORE_JCONTEXT}
${SOURCE_CORE_JMEM}
${SOURCE_CORE_JRT}
${SOURCE_CORE_LIT}
${SOURCE_CORE_PARSER_JS}
${SOURCE_CORE_PARSER_REGEXP}
${SOURCE_CORE_VM})
# Jerry port
file(GLOB SOURCE_PORT_FILES "${PORT_DIR}/*.c")
# All-in-one build
if(ENABLE_ALL_IN_ONE)
set(ALL_IN_FILE "${CMAKE_BINARY_DIR}/jerry-all-in.c")
list(SORT SOURCE_CORE_FILES)
file(REMOVE ${ALL_IN_FILE})
foreach(FILE ${SOURCE_CORE_FILES})
file(APPEND ${ALL_IN_FILE} "#include \"${FILE}\"\n")
endforeach()
foreach(FILE ${SOURCE_PORT_FILES})
file(APPEND ${ALL_IN_FILE} "#include \"${FILE}\"\n")
endforeach()
set(SOURCE_CORE ${ALL_IN_FILE})
else()
set(SOURCE_CORE ${SOURCE_CORE_FILES} ${SOURCE_PORT_FILES})
endif()
# Third-party
# Valgrind
set(INCLUDE_THIRD_PARTY_VALGRIND "${CMAKE_SOURCE_DIR}/third-party/valgrind")
# Definitions
# Get version information from git
if(IS_DIRECTORY "${CMAKE_SOURCE_DIR}/.git")
execute_process(COMMAND git symbolic-ref -q HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE JERRY_GIT_BRANCH
OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE JERRY_GIT_COMMIT
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
set(JERRY_GIT_BRANCH "UNDEFINED")
set(JERRY_GIT_COMMIT "UNDEFINED")
if(JERRY_VALGRIND)
set(INCLUDE_CORE_PRIVATE ${INCLUDE_CORE_PRIVATE} ${INCLUDE_THIRD_PARTY_VALGRIND})
endif()
# Get build date
execute_process(COMMAND date +%d/%m/%Y
OUTPUT_VARIABLE JERRY_BUILD_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(INCLUDE_CORE_PUBLIC ${INCLUDE_CORE_PUBLIC} PARENT_SCOPE) # for jerry-port
set(INCLUDE_CORE_PRIVATE ${INCLUDE_CORE_PRIVATE} PARENT_SCOPE) # for tests/unit-core
set(DEFINES_JERRY
${DEFINES_JERRY}
JERRY_BUILD_DATE="${JERRY_BUILD_DATE}"
JERRY_COMMIT_HASH="${JERRY_GIT_COMMIT}"
JERRY_BRANCH_NAME="${JERRY_GIT_BRANCH}")
# Sources
# Jerry core
set(SOURCE_CORE_FILES
api/jerry-debugger-transport.c
api/jerry-debugger.c
api/jerry-module.c
api/jerry-snapshot.c
api/jerryscript.c
debugger/debugger.c
ecma/base/ecma-alloc.c
ecma/base/ecma-gc.c
ecma/base/ecma-errors.c
ecma/base/ecma-extended-info.c
ecma/base/ecma-helpers-collection.c
ecma/base/ecma-helpers-conversion.c
ecma/base/ecma-helpers-errol.c
ecma/base/ecma-helpers-external-pointers.c
ecma/base/ecma-helpers-number.c
ecma/base/ecma-helpers-string.c
ecma/base/ecma-helpers-value.c
ecma/base/ecma-helpers.c
ecma/base/ecma-init-finalize.c
ecma/base/ecma-lcache.c
ecma/base/ecma-line-info.c
ecma/base/ecma-literal-storage.c
ecma/base/ecma-module.c
ecma/base/ecma-property-hashmap.c
ecma/builtin-objects/ecma-builtin-aggregateerror.c
ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c
ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c
ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c
ecma/builtin-objects/ecma-builtin-array-prototype.c
ecma/builtin-objects/ecma-builtin-array.c
ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c
ecma/builtin-objects/ecma-builtin-arraybuffer.c
ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c
ecma/builtin-objects/ecma-builtin-async-function-prototype.c
ecma/builtin-objects/ecma-builtin-async-function.c
ecma/builtin-objects/ecma-builtin-async-generator-function.c
ecma/builtin-objects/ecma-builtin-async-generator-prototype.c
ecma/builtin-objects/ecma-builtin-async-generator.c
ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c
ecma/builtin-objects/ecma-builtin-atomics.c
ecma/builtin-objects/ecma-builtin-bigint-prototype.c
ecma/builtin-objects/ecma-builtin-bigint.c
ecma/builtin-objects/ecma-builtin-boolean-prototype.c
ecma/builtin-objects/ecma-builtin-boolean.c
ecma/builtin-objects/ecma-builtin-dataview-prototype.c
ecma/builtin-objects/ecma-builtin-dataview.c
ecma/builtin-objects/ecma-builtin-date-prototype.c
ecma/builtin-objects/ecma-builtin-date.c
ecma/builtin-objects/ecma-builtin-error-prototype.c
ecma/builtin-objects/ecma-builtin-error.c
ecma/builtin-objects/ecma-builtin-evalerror-prototype.c
ecma/builtin-objects/ecma-builtin-evalerror.c
ecma/builtin-objects/ecma-builtin-function-prototype.c
ecma/builtin-objects/ecma-builtin-function.c
ecma/builtin-objects/ecma-builtin-generator-function.c
ecma/builtin-objects/ecma-builtin-generator-prototype.c
ecma/builtin-objects/ecma-builtin-generator.c
ecma/builtin-objects/ecma-builtin-global.c
ecma/builtin-objects/ecma-builtin-handlers.c
ecma/builtin-objects/ecma-builtin-helpers-date.c
ecma/builtin-objects/ecma-builtin-helpers-error.c
ecma/builtin-objects/ecma-builtin-helpers-json.c
ecma/builtin-objects/ecma-builtin-helpers-sort.c
ecma/builtin-objects/ecma-builtin-helpers.c
ecma/builtin-objects/ecma-builtin-intrinsic.c
ecma/builtin-objects/ecma-builtin-iterator-prototype.c
ecma/builtin-objects/ecma-builtin-json.c
ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c
ecma/builtin-objects/ecma-builtin-map-prototype.c
ecma/builtin-objects/ecma-builtin-map.c
ecma/builtin-objects/ecma-builtin-math.c
ecma/builtin-objects/ecma-builtin-number-prototype.c
ecma/builtin-objects/ecma-builtin-number.c
ecma/builtin-objects/ecma-builtin-object-prototype.c
ecma/builtin-objects/ecma-builtin-object.c
ecma/builtin-objects/ecma-builtin-promise-prototype.c
ecma/builtin-objects/ecma-builtin-promise.c
ecma/builtin-objects/ecma-builtin-proxy.c
ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c
ecma/builtin-objects/ecma-builtin-rangeerror.c
ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c
ecma/builtin-objects/ecma-builtin-referenceerror.c
ecma/builtin-objects/ecma-builtin-reflect.c
ecma/builtin-objects/ecma-builtin-regexp-prototype.c
ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c
ecma/builtin-objects/ecma-builtin-regexp.c
ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c
ecma/builtin-objects/ecma-builtin-set-prototype.c
ecma/builtin-objects/ecma-builtin-set.c
ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c
ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c
ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c
ecma/builtin-objects/ecma-builtin-string-prototype.c
ecma/builtin-objects/ecma-builtin-string.c
ecma/builtin-objects/ecma-builtin-symbol-prototype.c
ecma/builtin-objects/ecma-builtin-symbol.c
ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c
ecma/builtin-objects/ecma-builtin-syntaxerror.c
ecma/builtin-objects/ecma-builtin-type-error-thrower.c
ecma/builtin-objects/ecma-builtin-typeerror-prototype.c
ecma/builtin-objects/ecma-builtin-typeerror.c
ecma/builtin-objects/ecma-builtin-urierror-prototype.c
ecma/builtin-objects/ecma-builtin-urierror.c
ecma/builtin-objects/ecma-builtin-weakmap-prototype.c
ecma/builtin-objects/ecma-builtin-weakmap.c
ecma/builtin-objects/ecma-builtin-weakref-prototype.c
ecma/builtin-objects/ecma-builtin-weakref.c
ecma/builtin-objects/ecma-builtin-weakset-prototype.c
ecma/builtin-objects/ecma-builtin-weakset.c
ecma/builtin-objects/ecma-builtins.c
ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c
ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c
ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-float32array.c
ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-float64array.c
ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-int16array.c
ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-int32array.c
ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-int8array.c
ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c
ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c
ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c
ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c
ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c
ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c
ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c
ecma/operations/ecma-arguments-object.c
ecma/operations/ecma-array-object.c
ecma/operations/ecma-arraybuffer-object.c
ecma/operations/ecma-async-generator-object.c
ecma/operations/ecma-atomics-object.c
ecma/operations/ecma-big-uint.c
ecma/operations/ecma-bigint-object.c
ecma/operations/ecma-bigint.c
ecma/operations/ecma-boolean-object.c
ecma/operations/ecma-comparison.c
ecma/operations/ecma-container-object.c
ecma/operations/ecma-conversion.c
ecma/operations/ecma-dataview-object.c
ecma/operations/ecma-eval.c
ecma/operations/ecma-exceptions.c
ecma/operations/ecma-function-object.c
ecma/operations/ecma-get-put-value.c
ecma/operations/ecma-iterator-object.c
ecma/operations/ecma-jobqueue.c
ecma/operations/ecma-lex-env.c
ecma/operations/ecma-number-object.c
ecma/operations/ecma-objects-general.c
ecma/operations/ecma-objects.c
ecma/operations/ecma-promise-object.c
ecma/operations/ecma-proxy-object.c
ecma/operations/ecma-reference.c
ecma/operations/ecma-regexp-object.c
ecma/operations/ecma-shared-arraybuffer-object.c
ecma/operations/ecma-string-object.c
ecma/operations/ecma-symbol-object.c
ecma/operations/ecma-typedarray-object.c
jcontext/jcontext.c
jmem/jmem-allocator.c
jmem/jmem-heap.c
jmem/jmem-poolman.c
jrt/jrt-fatals.c
jrt/jrt-logging.c
lit/lit-char-helpers.c
lit/lit-magic-strings.c
lit/lit-strings.c
parser/js/byte-code.c
parser/js/common.c
parser/js/js-lexer.c
parser/js/js-parser-expr.c
parser/js/js-parser-line-info-create.c
parser/js/js-parser-mem.c
parser/js/js-parser-module.c
parser/js/js-parser-statm.c
parser/js/js-parser-tagged-template-literal.c
parser/js/js-parser-util.c
parser/js/js-parser.c
parser/js/js-scanner-ops.c
parser/js/js-scanner-util.c
parser/js/js-scanner.c
parser/js/parser-errors.c
parser/regexp/re-bytecode.c
parser/regexp/re-compiler.c
parser/regexp/re-parser.c
vm/opcodes-ecma-arithmetics.c
vm/opcodes-ecma-bitwise.c
vm/opcodes-ecma-relational-equality.c
vm/opcodes.c
vm/vm-stack.c
vm/vm-utils.c
vm/vm.c
)
# Amalgamated JerryScript source/header build.
# The process will create the following files:
# * jerryscript.c
# * jerryscript.h
# * jerryscript-config.h
if(ENABLE_AMALGAM)
# Create single C/H file
set(HEADER_CORE_FILES
api/jerry-snapshot.h
debugger/debugger.h
ecma/base/ecma-alloc.h
ecma/base/ecma-error-messages.inc.h
ecma/base/ecma-errors.h
ecma/base/ecma-gc.h
ecma/base/ecma-globals.h
ecma/base/ecma-helpers.h
ecma/base/ecma-init-finalize.h
ecma/base/ecma-lcache.h
ecma/base/ecma-line-info.h
ecma/base/ecma-literal-storage.h
ecma/base/ecma-module.h
ecma/base/ecma-property-hashmap.h
ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h
ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h
ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h
ecma/builtin-objects/ecma-builtin-array-prototype.inc.h
ecma/builtin-objects/ecma-builtin-array.inc.h
ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h
ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h
ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h
ecma/builtin-objects/ecma-builtin-async-function.inc.h
ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h
ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-async-generator.inc.h
ecma/builtin-objects/ecma-builtin-async-iterator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-atomics.inc.h
ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h
ecma/builtin-objects/ecma-builtin-bigint.inc.h
ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h
ecma/builtin-objects/ecma-builtin-boolean.inc.h
ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h
ecma/builtin-objects/ecma-builtin-dataview.inc.h
ecma/builtin-objects/ecma-builtin-date-prototype.inc.h
ecma/builtin-objects/ecma-builtin-date.inc.h
ecma/builtin-objects/ecma-builtin-error-prototype.inc.h
ecma/builtin-objects/ecma-builtin-error.inc.h
ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h
ecma/builtin-objects/ecma-builtin-evalerror.inc.h
ecma/builtin-objects/ecma-builtin-function-prototype.h
ecma/builtin-objects/ecma-builtin-function-prototype.inc.h
ecma/builtin-objects/ecma-builtin-function.inc.h
ecma/builtin-objects/ecma-builtin-generator-function.inc.h
ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-generator.inc.h
ecma/builtin-objects/ecma-builtin-global.inc.h
ecma/builtin-objects/ecma-builtin-handlers.h
ecma/builtin-objects/ecma-builtin-handlers.inc.h
ecma/builtin-objects/ecma-builtin-helpers-macro-defines.inc.h
ecma/builtin-objects/ecma-builtin-helpers-macro-undefs.inc.h
ecma/builtin-objects/ecma-builtin-helpers.h
ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h
ecma/builtin-objects/ecma-builtin-intrinsic.inc.h
ecma/builtin-objects/ecma-builtin-iterator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-json.inc.h
ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-map-prototype.inc.h
ecma/builtin-objects/ecma-builtin-map.inc.h
ecma/builtin-objects/ecma-builtin-math.inc.h
ecma/builtin-objects/ecma-builtin-number-prototype.inc.h
ecma/builtin-objects/ecma-builtin-number.inc.h
ecma/builtin-objects/ecma-builtin-object-prototype.inc.h
ecma/builtin-objects/ecma-builtin-object.h
ecma/builtin-objects/ecma-builtin-object.inc.h
ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h
ecma/builtin-objects/ecma-builtin-promise.inc.h
ecma/builtin-objects/ecma-builtin-proxy.inc.h
ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h
ecma/builtin-objects/ecma-builtin-rangeerror.inc.h
ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h
ecma/builtin-objects/ecma-builtin-referenceerror.inc.h
ecma/builtin-objects/ecma-builtin-reflect.inc.h
ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h
ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-regexp.inc.h
ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-set-prototype.inc.h
ecma/builtin-objects/ecma-builtin-set.inc.h
ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h
ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h
ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h
ecma/builtin-objects/ecma-builtin-string-prototype.inc.h
ecma/builtin-objects/ecma-builtin-string.inc.h
ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h
ecma/builtin-objects/ecma-builtin-symbol.inc.h
ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h
ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h
ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h
ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h
ecma/builtin-objects/ecma-builtin-typeerror.inc.h
ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h
ecma/builtin-objects/ecma-builtin-urierror.inc.h
ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h
ecma/builtin-objects/ecma-builtin-weakmap.inc.h
ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h
ecma/builtin-objects/ecma-builtin-weakref.inc.h
ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h
ecma/builtin-objects/ecma-builtin-weakset.inc.h
ecma/builtin-objects/ecma-builtins-internal.h
ecma/builtin-objects/ecma-builtins.h
ecma/builtin-objects/ecma-builtins.inc.h
ecma/operations/ecma-arguments-object.h
ecma/operations/ecma-array-object.h
ecma/operations/ecma-arraybuffer-object.h
ecma/operations/ecma-async-generator-object.h
ecma/operations/ecma-atomics-object.h
ecma/operations/ecma-big-uint.h
ecma/operations/ecma-bigint-object.h
ecma/operations/ecma-bigint.h
ecma/operations/ecma-boolean-object.h
ecma/operations/ecma-comparison.h
ecma/operations/ecma-container-object.h
ecma/operations/ecma-conversion.h
ecma/operations/ecma-dataview-object.h
ecma/operations/ecma-eval.h
ecma/operations/ecma-exceptions.h
ecma/operations/ecma-function-object.h
ecma/operations/ecma-iterator-object.h
ecma/operations/ecma-jobqueue.h
ecma/operations/ecma-lex-env.h
ecma/operations/ecma-number-object.h
ecma/operations/ecma-objects-general.h
ecma/operations/ecma-objects.h
ecma/operations/ecma-promise-object.h
ecma/operations/ecma-proxy-object.h
ecma/operations/ecma-reference.h
ecma/operations/ecma-regexp-object.h
ecma/operations/ecma-shared-arraybuffer-object.h
ecma/operations/ecma-string-object.h
ecma/operations/ecma-symbol-object.h
ecma/operations/ecma-typedarray-object.h
include/jerryscript-compiler.h
include/jerryscript-core.h
include/jerryscript-debugger-transport.h
include/jerryscript-debugger.h
include/jerryscript-port.h
include/jerryscript-snapshot.h
include/jerryscript.h
jcontext/jcontext.h
jmem/jmem-allocator-internal.h
jmem/jmem.h
jrt/jrt-bit-fields.h
jrt/jrt-libc-includes.h
jrt/jrt-types.h
jrt/jrt.h
lit/lit-char-helpers.h
lit/lit-globals.h
lit/lit-magic-strings.h
lit/lit-magic-strings.inc.h
lit/lit-strings.h
lit/lit-unicode-conversions-sup.inc.h
lit/lit-unicode-conversions.inc.h
lit/lit-unicode-folding.inc.h
lit/lit-unicode-ranges-sup.inc.h
lit/lit-unicode-ranges.inc.h
vm/opcodes.h
vm/vm-defines.h
vm/vm-stack.h
vm/vm.h
)
# Generated files
set(AMALGAM_CORE_C "${CMAKE_BINARY_DIR}/amalgam/jerryscript.c")
set(AMALGAM_CORE_H "${CMAKE_BINARY_DIR}/amalgam/jerryscript.h")
set(AMALGAM_CONFIG_H "${CMAKE_BINARY_DIR}/amalgam/jerryscript-config.h")
add_custom_command(OUTPUT ${AMALGAM_CORE_C} ${AMALGAM_CORE_H}
COMMAND ${PYTHON} ${CMAKE_SOURCE_DIR}/tools/amalgam.py
--jerry-core
--output-dir ${CMAKE_BINARY_DIR}/amalgam
DEPENDS ${SOURCE_CORE_FILES}
${HEADER_CORE_FILES}
${CMAKE_SOURCE_DIR}/tools/amalgam.py
)
# The "true" jerryscript-config.h will be generated by the configure_file below,
# which contains the default options and the ones passed for the CMake.
# The input for this is the jerryscript-config.h generated by the command above.
set(JERRYSCRIPT_GEN_CONFIG_H ${CMAKE_CURRENT_BINARY_DIR}/jerryscript-config.h)
add_custom_command(OUTPUT ${AMALGAM_CONFIG_H}
COMMAND ${CMAKE_COMMAND} -E copy ${JERRYSCRIPT_GEN_CONFIG_H} ${AMALGAM_CONFIG_H}
DEPENDS ${AMALGAM_CORE_C} ${AMALGAM_CORE_H})
add_custom_target(amalgam-jerry DEPENDS ${AMALGAM_CORE_C} ${AMALGAM_CORE_H} ${AMALGAM_CONFIG_H})
add_dependencies(amalgam amalgam-jerry)
set(SOURCE_CORE_FILES ${AMALGAM_CORE_C} ${AMALGAM_CORE_H} ${AMALGAM_CONFIG_H})
set(INCLUDE_CORE_PUBLIC PARENT_SCOPE)
set(INCLUDE_CORE_PRIVATE PARENT_SCOPE)
endif()
# build mode specific compile/link flags
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_PRETTY_PRINTER)
else()
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_NDEBUG)
endif()
# Profile modes
# Minimal profile
if(FEATURE_PROFILE STREQUAL "minimal")
set(DEFINES_JERRY ${DEFINES_JERRY}
CONFIG_DISABLE_NUMBER_BUILTIN
CONFIG_DISABLE_STRING_BUILTIN
CONFIG_DISABLE_BOOLEAN_BUILTIN
CONFIG_DISABLE_ERROR_BUILTINS
CONFIG_DISABLE_ARRAY_BUILTIN
CONFIG_DISABLE_MATH_BUILTIN
CONFIG_DISABLE_JSON_BUILTIN
CONFIG_DISABLE_DATE_BUILTIN
CONFIG_DISABLE_REGEXP_BUILTIN
CONFIG_DISABLE_ANNEXB_BUILTIN)
elseif(NOT FEATURE_PROFILE STREQUAL "full")
message(FATAL_ERROR "FEATURE_PROFILE='${FEATURE_PROFILE}' doesn't supported")
endif()
set(DEFINES_JERRY ${DEFINES_JERRY} $<$<NOT:$<CONFIG:Debug>>:JERRY_NDEBUG>)
# Jerry heap-section
if(DEFINED JERRY_HEAP_SECTION_ATTR)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_HEAP_SECTION_ATTR=${JERRY_HEAP_SECTION_ATTR})
if(DEFINED JERRY_ATTR_GLOBAL_HEAP)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ATTR_GLOBAL_HEAP=${JERRY_ATTR_GLOBAL_HEAP})
endif()
# Memory usage limit for triggering garbage collection
if(JERRY_GC_LIMIT)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_GC_LIMIT=${JERRY_GC_LIMIT})
endif()
# Helper macro to set 0/1 switch as Jerry Defines
macro(jerry_add_define01 NAME)
if(${NAME})
set(DEFINES_JERRY ${DEFINES_JERRY} ${NAME}=1)
else()
set(DEFINES_JERRY ${DEFINES_JERRY} ${NAME}=0)
endif()
endmacro(jerry_add_define01)
# Checks the optional features
# Enable 32 bit cpointers
jerry_add_define01(JERRY_CPOINTER_32_BIT)
# Fill error messages for builtin error objects
if(FEATURE_ERROR_MESSAGES)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_ERROR_MESSAGES)
endif()
jerry_add_define01(JERRY_ERROR_MESSAGES)
# Valgrind
if(FEATURE_VALGRIND)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_VALGRIND)
set(INCLUDE_CORE ${INCLUDE_CORE} ${INCLUDE_THIRD_PARTY_VALGRIND})
endif()
# Use external context instead of static one
jerry_add_define01(JERRY_EXTERNAL_CONTEXT)
# Valgrind Freya
if(FEATURE_VALGRIND_FREYA)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_VALGRIND_FREYA)
set(INCLUDE_CORE ${INCLUDE_CORE} ${INCLUDE_THIRD_PARTY_VALGRIND})
endif()
# JS-Parser
jerry_add_define01(JERRY_PARSER)
# Memory management stress-test mode
if(FEATURE_MEM_STRESS_TEST)
set(DEFINES_JERRY ${DEFINES_JERRY} JMEM_GC_BEFORE_EACH_ALLOC)
endif()
# JS function toString
jerry_add_define01(JERRY_FUNCTION_TO_STRING)
# JS line info
jerry_add_define01(JERRY_LINE_INFO)
# Logging
jerry_add_define01(JERRY_LOGGING)
# Memory statistics
if(FEATURE_MEM_STATS)
set(DEFINES_JERRY ${DEFINES_JERRY} JMEM_STATS)
endif()
jerry_add_define01(JERRY_MEM_STATS)
# Enable debugger
jerry_add_define01(JERRY_DEBUGGER)
# Memory management stress-test mode
jerry_add_define01(JERRY_MEM_GC_BEFORE_EACH_ALLOC)
# Parser byte-code dumps
if(FEATURE_PARSER_DUMP)
set(DEFINES_JERRY ${DEFINES_JERRY} PARSER_DUMP_BYTE_CODE)
jerry_add_define01(JERRY_PARSER_DUMP_BYTE_CODE)
# Profile
if (${JERRY_PROFILE} STREQUAL "es2015-subset")
message(DEPRECATION "'es2015-subset' profile is deprecated, please use 'es.next' instead.")
endif()
if (NOT IS_ABSOLUTE ${JERRY_PROFILE})
set(JERRY_PROFILE "${CMAKE_CURRENT_SOURCE_DIR}/profiles/${JERRY_PROFILE}.profile")
endif()
if(EXISTS ${JERRY_PROFILE})
file(READ "${JERRY_PROFILE}" PROFILE_SETTINGS)
string(REGEX REPLACE "[ \t]*#[^\n]*" "" PROFILE_SETTINGS "${PROFILE_SETTINGS}")
string(REGEX REPLACE "[\r\n]" ";" PROFILE_SETTINGS "${PROFILE_SETTINGS}")
# Process entries and save them as CMake variables.
# This is required to correctly generate the jerryscript-config.h file.
foreach(PROFILE_ENTRY ${PROFILE_SETTINGS})
string(REPLACE "=" ";" PROFILE_ENTRY "${PROFILE_ENTRY}")
list(GET PROFILE_ENTRY 0 PROFILE_KEY)
list(GET PROFILE_ENTRY 1 PROFILE_VALUE)
set(${PROFILE_KEY} ${PROFILE_VALUE})
endforeach()
set(DEFINES_JERRY ${DEFINES_JERRY} ${PROFILE_SETTINGS})
else()
message(FATAL_ERROR "Profile file: '${JERRY_PROFILE}' doesn't exist!")
endif()
# Promise callback
jerry_add_define01(JERRY_PROMISE_CALLBACK)
# RegExp strict mode
jerry_add_define01(JERRY_REGEXP_STRICT_MODE)
# RegExp byte-code dumps
if(FEATURE_REGEXP_DUMP)
set(DEFINES_JERRY ${DEFINES_JERRY} REGEXP_DUMP_BYTE_CODE)
endif()
# Snapshot save
if(FEATURE_SNAPSHOT_SAVE)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_SNAPSHOT_SAVE)
endif()
jerry_add_define01(JERRY_REGEXP_DUMP_BYTE_CODE)
# Snapshot exec
if(FEATURE_SNAPSHOT_EXEC)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_SNAPSHOT_EXEC)
endif()
jerry_add_define01(JERRY_SNAPSHOT_EXEC)
# Snapshot save
jerry_add_define01(JERRY_SNAPSHOT_SAVE)
# Enable system allocator
jerry_add_define01(JERRY_SYSTEM_ALLOCATOR)
# Valgrind
jerry_add_define01(JERRY_VALGRIND)
# Enable VM execution stop callback
jerry_add_define01(JERRY_VM_HALT)
# Enable VM throw callback
jerry_add_define01(JERRY_VM_THROW)
# Size of heap
math(EXPR MEM_HEAP_AREA_SIZE "${MEM_HEAP_SIZE_KB} * 1024")
set(DEFINES_JERRY ${DEFINES_JERRY} CONFIG_MEM_HEAP_AREA_SIZE=${MEM_HEAP_AREA_SIZE})
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_GLOBAL_HEAP_SIZE=${JERRY_GLOBAL_HEAP_SIZE})
add_library(${JERRY_CORE_NAME} STATIC ${SOURCE_CORE})
# Maximum size of stack memory usage
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_STACK_LIMIT=${JERRY_STACK_LIMIT})
# Maximum depth of recursion during GC mark phase
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_GC_MARK_LIMIT=${JERRY_GC_MARK_LIMIT})
## This function is to read "config.h" for default values
function(read_set_defines FILE PREFIX OUTPUTVAR)
file(READ "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}" INPUT_FILE_CONTENTS)
# match all "#define <PREFIX>\n" lines
# notes:
# * before the "#" there must be a newline and any number of spaces.
# * after the "#" there can be any number of spaces.
string(REGEX MATCHALL "\r?\n[ ]*#[ ]*define ${PREFIX}[^\n]*"
RAW_DEFINES "${INPUT_FILE_CONTENTS}")
set(SELECTED_VARS )
# Transform the defines to a list of (<name>; <value>; <name 2>; <value 2>; ...) list
foreach(DEFINE_ENTRY ${RAW_DEFINES})
# by default every define value is empty
set(DEFINE_VALUE " ")
# split up the define at the space between the define name and value (if there is any)
# first remove "#define" part of the string
string(REGEX REPLACE "\r?\n[ ]*#[ ]*define[ ]+" "" DEFINE_KEY_VALUE "${DEFINE_ENTRY}")
string(FIND "${DEFINE_KEY_VALUE}" " " DEFINE_KEY_IDX)
string(LENGTH "${DEFINE_KEY_VALUE}" DEFINE_LENGTH)
if (DEFINE_KEY_IDX EQUAL "-1")
set(DEFINE_KEY ${DEFINE_KEY_VALUE})
else()
string(SUBSTRING "${DEFINE_KEY_VALUE}" 0 ${DEFINE_KEY_IDX} DEFINE_KEY)
string(SUBSTRING "${DEFINE_KEY_VALUE}" ${DEFINE_KEY_IDX} -1 DEFINE_VALUE)
string(STRIP "${DEFINE_VALUE}" DEFINE_VALUE)
endif()
list(APPEND SELECTED_VARS ${DEFINE_KEY} ${DEFINE_VALUE})
endforeach()
set(${OUTPUTVAR} ${SELECTED_VARS} PARENT_SCOPE)
endfunction(read_set_defines)
# CONFIG_DEFAULTS contains define name and values which have the JERRY_ prefix
# as a list of (<name>; <value>; <name 2>; <value 2>; ...)
read_set_defines("config.h" JERRY_ CONFIG_DEFAULTS)
## Process the default values and build options to generate build config defines
list(LENGTH CONFIG_DEFAULTS CONFIG_DEFAULT_LENGTH)
math(EXPR CONFIG_DEFAULT_LENGTH "${CONFIG_DEFAULT_LENGTH} - 1")
set(JERRY_MODIFIED_OPTIONS)
foreach(CONFIG_IDX RANGE 0 ${CONFIG_DEFAULT_LENGTH} 2)
list(GET CONFIG_DEFAULTS ${CONFIG_IDX} KEY)
math(EXPR VALUE_IDX "${CONFIG_IDX} + 1")
list(GET CONFIG_DEFAULTS ${VALUE_IDX} VALUE)
# ${KEY} is the value for the given variable (aka define)
# normalize ON/OFF cmake values to 1/0 for easier processing.
if(${KEY} STREQUAL "ON")
set(${KEY} 1)
elseif(${KEY} STREQUAL "OFF")
set(${KEY} 0)
endif()
# Generate "#define JERRY_<CONFIG> <CONFIG_VALUE>" entries if it is different from
# the config default.
# If the define loaded from the config file have a different value than the
# relevant option passed for the CMake means that it does not have a default value.
if(DEFINED ${KEY} AND NOT (${KEY} STREQUAL ${VALUE}))
set(JERRY_MODIFIED_OPTIONS "${JERRY_MODIFIED_OPTIONS}#define ${KEY} ${${KEY}}\n")
endif()
endforeach()
# Generate the jerryscript-config.h file into the build directory
# This file will contain the options different from the default (aka it's the build config).
if(JERRY_MODIFIED_OPTIONS)
set(JERRY_BUILD_CFG
"Generated differences from default by CMake based on build options:\n${JERRY_MODIFIED_OPTIONS}")
else()
set(JERRY_BUILD_CFG "JerryScript configuration")
endif()
configure_file(config.h jerryscript-config.h @ONLY)
add_library(${JERRY_CORE_NAME} ${SOURCE_CORE_FILES})
target_compile_definitions(${JERRY_CORE_NAME} PUBLIC ${DEFINES_JERRY})
target_include_directories(${JERRY_CORE_NAME} PUBLIC ${INCLUDE_CORE})
target_include_directories(${JERRY_CORE_NAME} PUBLIC ${INCLUDE_CORE_PUBLIC})
target_include_directories(${JERRY_CORE_NAME} PRIVATE ${INCLUDE_CORE_PRIVATE})
add_dependencies(${JERRY_CORE_NAME} amalgam)
if (JERRY_LIBC)
target_include_directories(${JERRY_CORE_NAME} SYSTEM PRIVATE "${CMAKE_SOURCE_DIR}/jerry-libc/include")
set(JERRY_CORE_PKGCONFIG_REQUIRES)
set(JERRY_CORE_PKGCONFIG_LIBS)
set(JERRY_CORE_PKGCONFIG_CFLAGS)
if(ENABLE_LTO)
set(JERRY_CORE_PKGCONFIG_CFLAGS "${JERRY_CORE_PKGCONFIG_CFLAGS} -flto")
endif()
if(JERRY_MATH)
target_link_libraries(${JERRY_CORE_NAME} jerry-math)
set(JERRY_CORE_PKGCONFIG_REQUIRES libjerry-math)
else()
if(USING_GCC OR USING_CLANG)
set(CMAKE_REQUIRED_FLAGS "-Wno-error -Wno-error=strict-prototypes")
endif()
check_library_exists(m sin "" HAVE_M_LIB)
if(HAVE_M_LIB)
target_link_libraries(${JERRY_CORE_NAME} m)
set(JERRY_CORE_PKGCONFIG_LIBS "${JERRY_CORE_PKGCONFIG_LIBS} -lm")
endif()
endif()
separate_arguments(EXTERNAL_LINK_LIBS)
foreach(EXT_LIB ${EXTERNAL_LINK_LIBS})
target_link_libraries(${JERRY_CORE_NAME} ${EXT_LIB})
set(JERRY_CORE_PKGCONFIG_LIBS "${JERRY_CORE_PKGCONFIG_LIBS} -l${EXT_LIB}")
endforeach()
configure_file(libjerry-core.pc.in libjerry-core.pc @ONLY)
install(TARGETS ${JERRY_CORE_NAME} DESTINATION lib)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-core.pc DESTINATION lib/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/jerryscript-config.h DESTINATION include)
install(DIRECTORY ${INCLUDE_CORE_PUBLIC}/ DESTINATION include)
+248
View File
@@ -0,0 +1,248 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "jerryscript.h"
#include "debugger.h"
#include "jcontext.h"
#if JERRY_DEBUGGER
/**
* Minimum number of bytes transmitted or received.
*/
#define JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE 64
/**
* Sleep time in milliseconds between each jerry_debugger_receive call
*/
#define JERRY_DEBUGGER_TRANSPORT_TIMEOUT 100
/**
* Add a new transport layer.
*/
void
jerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p, /**< transport implementation */
size_t send_message_header_size, /**< header bytes reserved for outgoing messages */
size_t max_send_message_size, /**< maximum number of bytes transmitted in a message */
size_t receive_message_header_size, /**< header bytes reserved for incoming messages */
size_t max_receive_message_size) /**< maximum number of bytes received in a message */
{
JERRY_ASSERT (max_send_message_size > JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE
&& max_receive_message_size > JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE);
header_p->next_p = JERRY_CONTEXT (debugger_transport_header_p);
JERRY_CONTEXT (debugger_transport_header_p) = header_p;
uint8_t *payload_p;
size_t max_send_size;
size_t max_receive_size;
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
payload_p = JERRY_CONTEXT (debugger_send_buffer_payload_p);
max_send_size = JERRY_CONTEXT (debugger_max_send_size);
max_receive_size = JERRY_CONTEXT (debugger_max_receive_size);
}
else
{
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_CONNECTED);
payload_p = JERRY_CONTEXT (debugger_send_buffer);
max_send_size = JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE;
max_receive_size = JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE;
}
JERRY_ASSERT (max_send_size > JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE + send_message_header_size);
JERRY_ASSERT (max_receive_size > JERRY_DEBUGGER_TRANSPORT_MIN_BUFFER_SIZE + receive_message_header_size);
JERRY_CONTEXT (debugger_send_buffer_payload_p) = payload_p + send_message_header_size;
max_send_size = max_send_size - send_message_header_size;
max_receive_size = max_receive_size - receive_message_header_size;
if (max_send_size > max_send_message_size)
{
max_send_size = max_send_message_size;
}
if (max_receive_size > max_receive_message_size)
{
max_receive_size = max_receive_message_size;
}
JERRY_CONTEXT (debugger_max_send_size) = (uint8_t) max_send_size;
JERRY_CONTEXT (debugger_max_receive_size) = (uint8_t) max_receive_size;
} /* jerry_debugger_transport_add */
/**
* Starts the communication to the debugger client.
* Must be called after the connection is successfully established.
*/
void
jerry_debugger_transport_start (void)
{
JERRY_ASSERT (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED);
if (jerry_debugger_send_configuration (JERRY_CONTEXT (debugger_max_receive_size)))
{
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);
JERRY_CONTEXT (debugger_stop_context) = NULL;
}
} /* jerry_debugger_transport_start */
/**
* Returns true if a debugger client is connected.
*
* @return true - a debugger client is connected,
* false - otherwise
*/
bool
jerry_debugger_transport_is_connected (void)
{
return (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) != 0;
} /* jerry_debugger_transport_is_connected */
/**
* Notifies the debugger server that the connection is closed.
*/
void
jerry_debugger_transport_close (void)
{
if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED))
{
return;
}
JERRY_CONTEXT (debugger_flags) = JERRY_DEBUGGER_VM_IGNORE;
jerry_debugger_transport_header_t *current_p = JERRY_CONTEXT (debugger_transport_header_p);
JERRY_ASSERT (current_p != NULL);
do
{
jerry_debugger_transport_header_t *next_p = current_p->next_p;
current_p->close (current_p);
current_p = next_p;
} while (current_p != NULL);
jerry_log (JERRY_LOG_LEVEL_DEBUG, "Debugger client connection closed.\n");
jerry_debugger_free_unreferenced_byte_code ();
} /* jerry_debugger_transport_close */
/**
* Send data over the current connection
*
* @return true - data sent successfully,
* false - connection closed
*/
bool
jerry_debugger_transport_send (const uint8_t *message_p, /**< message to be sent */
size_t message_length) /**< message length in bytes */
{
JERRY_ASSERT (jerry_debugger_transport_is_connected ());
JERRY_ASSERT (message_length > 0);
jerry_debugger_transport_header_t *header_p = JERRY_CONTEXT (debugger_transport_header_p);
uint8_t *payload_p = JERRY_CONTEXT (debugger_send_buffer_payload_p);
size_t max_send_size = JERRY_CONTEXT (debugger_max_send_size);
do
{
size_t fragment_length = (message_length <= max_send_size ? message_length : max_send_size);
memcpy (payload_p, message_p, fragment_length);
if (!header_p->send (header_p, payload_p, fragment_length))
{
return false;
}
message_p += fragment_length;
message_length -= fragment_length;
} while (message_length > 0);
return true;
} /* jerry_debugger_transport_send */
/**
* Receive data from the current connection
*
* Note:
* A message is received if message_start_p is not NULL
*
* @return true - function successfully completed,
* false - connection closed
*/
bool
jerry_debugger_transport_receive (jerry_debugger_transport_receive_context_t *context_p) /**< [out] receive
* context */
{
JERRY_ASSERT (jerry_debugger_transport_is_connected ());
context_p->buffer_p = JERRY_CONTEXT (debugger_receive_buffer);
context_p->received_length = JERRY_CONTEXT (debugger_received_length);
context_p->message_p = NULL;
context_p->message_length = 0;
context_p->message_total_length = 0;
jerry_debugger_transport_header_t *header_p = JERRY_CONTEXT (debugger_transport_header_p);
return header_p->receive (header_p, context_p);
} /* jerry_debugger_transport_receive */
/**
* Clear the message buffer after the message is processed
*/
void
jerry_debugger_transport_receive_completed (jerry_debugger_transport_receive_context_t *context_p) /**< receive
* context */
{
JERRY_ASSERT (context_p->message_p != NULL);
JERRY_ASSERT (context_p->buffer_p == JERRY_CONTEXT (debugger_receive_buffer));
size_t message_total_length = context_p->message_total_length;
size_t received_length = context_p->received_length;
JERRY_ASSERT (message_total_length <= received_length);
if (message_total_length == 0 || message_total_length == received_length)
{
/* All received data is processed. */
JERRY_CONTEXT (debugger_received_length) = 0;
return;
}
uint8_t *buffer_p = context_p->buffer_p;
received_length -= message_total_length;
memmove (buffer_p, buffer_p + message_total_length, received_length);
JERRY_CONTEXT (debugger_received_length) = (uint16_t) received_length;
} /* jerry_debugger_transport_receive_completed */
/**
* Suspend execution for a predefined time (JERRY_DEBUGGER_TRANSPORT_TIMEOUT ms).
*/
void
jerry_debugger_transport_sleep (void)
{
jerry_port_sleep (JERRY_DEBUGGER_TRANSPORT_TIMEOUT);
} /* jerry_debugger_transport_sleep */
#endif /* JERRY_DEBUGGER */
+208
View File
@@ -0,0 +1,208 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "jerryscript.h"
#include "debugger.h"
#include "jcontext.h"
/**
* Checks whether the debugger is connected.
*
* @return true - if the debugger is connected
* false - otherwise
*/
bool
jerry_debugger_is_connected (void)
{
#if JERRY_DEBUGGER
return JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED;
#else /* !JERRY_DEBUGGER */
return false;
#endif /* JERRY_DEBUGGER */
} /* jerry_debugger_is_connected */
/**
* Stop execution at the next available breakpoint.
*/
void
jerry_debugger_stop (void)
{
#if JERRY_DEBUGGER
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_STOP);
JERRY_CONTEXT (debugger_stop_context) = NULL;
}
#endif /* JERRY_DEBUGGER */
} /* jerry_debugger_stop */
/**
* Continue execution.
*/
void
jerry_debugger_continue (void)
{
#if JERRY_DEBUGGER
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_STOP);
JERRY_CONTEXT (debugger_stop_context) = NULL;
}
#endif /* JERRY_DEBUGGER */
} /* jerry_debugger_continue */
/**
* Sets whether the engine should stop at breakpoints.
*/
void
jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint) /**< enable/disable stop at breakpoint */
{
#if JERRY_DEBUGGER
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
if (enable_stop_at_breakpoint)
{
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_VM_IGNORE);
}
else
{
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_VM_IGNORE);
}
}
#else /* !JERRY_DEBUGGER */
JERRY_UNUSED (enable_stop_at_breakpoint);
#endif /* JERRY_DEBUGGER */
} /* jerry_debugger_stop_at_breakpoint */
/**
* Sets whether the engine should wait and run a source.
*
* @return enum JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED - if the source is not received
* JERRY_DEBUGGER_SOURCE_RECEIVED - if a source code received
* JERRY_DEBUGGER_SOURCE_END - the end of the source codes
* JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED - the end of the context
*/
jerry_debugger_wait_for_source_status_t
jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p, /**< callback function */
void *user_p, /**< user pointer passed to the callback */
jerry_value_t *return_value) /**< [out] parse and run return value */
{
*return_value = jerry_undefined ();
#if JERRY_DEBUGGER
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
JERRY_DEBUGGER_SET_FLAGS (JERRY_DEBUGGER_CLIENT_SOURCE_MODE);
jerry_debugger_uint8_data_t *client_source_data_p = NULL;
jerry_debugger_wait_for_source_status_t ret_type = JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;
/* Notify the client about that the engine is waiting for a source. */
jerry_debugger_send_type (JERRY_DEBUGGER_WAIT_FOR_SOURCE);
while (true)
{
if (jerry_debugger_receive (&client_source_data_p))
{
if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED))
{
break;
}
/* Stop executing the current context. */
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONTEXT_RESET_MODE))
{
ret_type = JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED;
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_CONTEXT_RESET_MODE);
break;
}
/* Stop waiting for a new source file. */
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CLIENT_NO_SOURCE))
{
ret_type = JERRY_DEBUGGER_SOURCE_END;
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_CLIENT_SOURCE_MODE);
break;
}
/* The source arrived. */
if (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CLIENT_SOURCE_MODE))
{
JERRY_ASSERT (client_source_data_p != NULL);
jerry_char_t *source_name_p = (jerry_char_t *) (client_source_data_p + 1);
size_t source_name_size = strlen ((const char *) source_name_p);
*return_value = callback_p (source_name_p,
source_name_size,
source_name_p + source_name_size + 1,
client_source_data_p->uint8_size - source_name_size - 1,
user_p);
ret_type = JERRY_DEBUGGER_SOURCE_RECEIVED;
break;
}
}
jerry_debugger_transport_sleep ();
}
JERRY_ASSERT (!(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CLIENT_SOURCE_MODE)
|| !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED));
if (client_source_data_p != NULL)
{
/* The data may partly arrived. */
jmem_heap_free_block (client_source_data_p,
client_source_data_p->uint8_size + sizeof (jerry_debugger_uint8_data_t));
}
return ret_type;
}
return JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;
#else /* !JERRY_DEBUGGER */
JERRY_UNUSED (callback_p);
JERRY_UNUSED (user_p);
return JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED;
#endif /* JERRY_DEBUGGER */
} /* jerry_debugger_wait_for_client_source */
/**
* Send the output of the program to the debugger client.
* Currently only sends print output.
*/
void
jerry_debugger_send_output (const jerry_char_t *buffer, /**< buffer */
jerry_size_t str_size) /**< string size */
{
#if JERRY_DEBUGGER
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
{
jerry_debugger_send_string (JERRY_DEBUGGER_OUTPUT_RESULT,
JERRY_DEBUGGER_OUTPUT_PRINT,
(const uint8_t *) buffer,
sizeof (uint8_t) * str_size);
}
#else /* !JERRY_DEBUGGER */
JERRY_UNUSED (buffer);
JERRY_UNUSED (str_size);
#endif /* JERRY_DEBUGGER */
} /* jerry_debugger_send_output */
+247
View File
@@ -0,0 +1,247 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "jerryscript-core.h"
#include "jerryscript-port.h"
#include "ecma-errors.h"
#include "lit-magic-strings.h"
#include "lit-strings.h"
#if JERRY_MODULE_SYSTEM
/**
* A module descriptor.
*/
typedef struct jerry_module_t
{
struct jerry_module_t *next_p; /**< next_module */
jerry_char_t *path_p; /**< path to the module */
jerry_size_t basename_offset; /**< offset of the basename in the module path*/
jerry_value_t realm; /**< the realm of the module */
jerry_value_t module; /**< the module itself */
} jerry_module_t;
/**
* Native info descriptor for modules.
*/
static const jerry_object_native_info_t jerry_module_native_info JERRY_ATTR_CONST_DATA = {
.free_cb = NULL,
};
/**
* Default module manager.
*/
typedef struct
{
jerry_module_t *module_head_p; /**< first module */
} jerry_module_manager_t;
/**
* Release known modules.
*/
static void
jerry_module_free (jerry_module_manager_t *manager_p, /**< module manager */
const jerry_value_t realm) /**< if this argument is object, release only those modules,
* which realm value is equal to this argument. */
{
jerry_module_t *module_p = manager_p->module_head_p;
bool release_all = !jerry_value_is_object (realm);
jerry_module_t *prev_p = NULL;
while (module_p != NULL)
{
jerry_module_t *next_p = module_p->next_p;
if (release_all || module_p->realm == realm)
{
jerry_port_path_free (module_p->path_p);
jerry_value_free (module_p->realm);
jerry_value_free (module_p->module);
jerry_heap_free (module_p, sizeof (jerry_module_t));
if (prev_p == NULL)
{
manager_p->module_head_p = next_p;
}
else
{
prev_p->next_p = next_p;
}
}
else
{
prev_p = module_p;
}
module_p = next_p;
}
} /* jerry_module_free */
/**
* Initialize the default module manager.
*/
static void
jerry_module_manager_init (void *user_data_p)
{
((jerry_module_manager_t *) user_data_p)->module_head_p = NULL;
} /* jerry_module_manager_init */
/**
* Deinitialize the default module manager.
*/
static void
jerry_module_manager_deinit (void *user_data_p) /**< context pointer to deinitialize */
{
jerry_value_t undef = jerry_undefined ();
jerry_module_free ((jerry_module_manager_t *) user_data_p, undef);
jerry_value_free (undef);
} /* jerry_module_manager_deinit */
/**
* Declare the context data manager for modules.
*/
static const jerry_context_data_manager_t jerry_module_manager JERRY_ATTR_CONST_DATA = {
.init_cb = jerry_module_manager_init,
.deinit_cb = jerry_module_manager_deinit,
.bytes_needed = sizeof (jerry_module_manager_t)
};
#endif /* JERRY_MODULE_SYSTEM */
/**
* Default module resolver.
*
* @return a module object if resolving is successful, an error otherwise
*/
jerry_value_t
jerry_module_resolve (const jerry_value_t specifier, /**< module specifier string */
const jerry_value_t referrer, /**< parent module */
void *user_p) /**< user data */
{
#if JERRY_MODULE_SYSTEM
JERRY_UNUSED (user_p);
const jerry_char_t *directory_p = lit_get_magic_string_utf8 (LIT_MAGIC_STRING__EMPTY);
jerry_size_t directory_size = lit_get_magic_string_size (LIT_MAGIC_STRING__EMPTY);
jerry_module_t *module_p = jerry_object_get_native_ptr (referrer, &jerry_module_native_info);
if (module_p != NULL)
{
directory_p = module_p->path_p;
directory_size = module_p->basename_offset;
}
jerry_size_t specifier_size = jerry_string_size (specifier, JERRY_ENCODING_UTF8);
jerry_size_t reference_size = directory_size + specifier_size;
jerry_char_t *reference_path_p = jerry_heap_alloc (reference_size + 1);
memcpy (reference_path_p, directory_p, directory_size);
jerry_string_to_buffer (specifier, JERRY_ENCODING_UTF8, reference_path_p + directory_size, specifier_size);
reference_path_p[reference_size] = '\0';
jerry_char_t *path_p = jerry_port_path_normalize (reference_path_p, reference_size);
jerry_heap_free (reference_path_p, reference_size + 1);
if (path_p == NULL)
{
return jerry_throw_sz (JERRY_ERROR_SYNTAX, "Failed to resolve module");
}
jerry_value_t realm = jerry_current_realm ();
jerry_module_manager_t *manager_p;
manager_p = (jerry_module_manager_t *) jerry_context_data (&jerry_module_manager);
module_p = manager_p->module_head_p;
while (module_p != NULL)
{
if (module_p->realm == realm && strcmp ((const char *) module_p->path_p, (const char *) path_p) == 0)
{
jerry_value_free (realm);
jerry_port_path_free (path_p);
return jerry_value_copy (module_p->module);
}
module_p = module_p->next_p;
}
jerry_size_t source_size;
jerry_char_t *source_p = jerry_port_source_read ((const char *) path_p, &source_size);
if (source_p == NULL)
{
jerry_value_free (realm);
jerry_port_path_free (path_p);
return jerry_throw_sz (JERRY_ERROR_SYNTAX, "Module file not found");
}
jerry_parse_options_t parse_options;
parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_SOURCE_NAME;
parse_options.source_name = jerry_value_copy (specifier);
jerry_value_t ret_value = jerry_parse (source_p, source_size, &parse_options);
jerry_value_free (parse_options.source_name);
jerry_port_source_free (source_p);
if (jerry_value_is_exception (ret_value))
{
jerry_port_path_free (path_p);
jerry_value_free (realm);
return ret_value;
}
module_p = (jerry_module_t *) jerry_heap_alloc (sizeof (jerry_module_t));
module_p->next_p = manager_p->module_head_p;
module_p->path_p = path_p;
module_p->basename_offset = jerry_port_path_base (module_p->path_p);
module_p->realm = realm;
module_p->module = jerry_value_copy (ret_value);
jerry_object_set_native_ptr (ret_value, &jerry_module_native_info, module_p);
manager_p->module_head_p = module_p;
return ret_value;
#else /* JERRY_MODULE_SYSTEM */
JERRY_UNUSED (specifier);
JERRY_UNUSED (referrer);
JERRY_UNUSED (user_p);
return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_MODULE_NOT_SUPPORTED));
#endif /* JERRY_MODULE_SYSTEM */
} /* jerry_module_resolve */
/**
* Release known modules.
*/
void
jerry_module_cleanup (const jerry_value_t realm) /**< if this argument is object, release only those modules,
* whose realm value is equal to this argument. */
{
#if JERRY_MODULE_SYSTEM
jerry_module_free ((jerry_module_manager_t *) jerry_context_data (&jerry_module_manager), realm);
#else /* JERRY_MODULE_SYSTEM */
JERRY_UNUSED (realm);
#endif /* JERRY_MODULE_SYSTEM */
} /* jerry_module_cleanup */
File diff suppressed because it is too large Load Diff
+53
View File
@@ -0,0 +1,53 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef JERRY_SNAPSHOT_H
#define JERRY_SNAPSHOT_H
#include "ecma-globals.h"
/**
* Snapshot header
*/
typedef struct
{
/* The size of this structure is recommended to be divisible by
* uint32_t alignment. Otherwise some bytes after the header are wasted. */
uint32_t magic; /**< four byte magic number */
uint32_t version; /**< version number */
uint32_t global_flags; /**< global configuration and feature flags */
uint32_t lit_table_offset; /**< byte offset of the literal table */
uint32_t number_of_funcs; /**< number of primary ECMAScript functions */
uint32_t func_offsets[1]; /**< function offsets (lowest bit: global(0) or eval(1) context) */
} jerry_snapshot_header_t;
/**
* Jerry snapshot magic marker.
*/
#define JERRY_SNAPSHOT_MAGIC (0x5952524Au)
/**
* Snapshot configuration flags.
*/
typedef enum
{
/* 8 bits are reserved for dynamic features */
JERRY_SNAPSHOT_HAS_REGEX_LITERAL = (1u << 0), /**< byte code has regex literal */
JERRY_SNAPSHOT_HAS_CLASS_LITERAL = (1u << 1), /**< byte code has class literal */
/* 24 bits are reserved for compile time features */
JERRY_SNAPSHOT_FOUR_BYTE_CPOINTER = (1u << 8) /**< deprecated, an unused placeholder now */
} jerry_snapshot_global_flags_t;
#endif /* !JERRY_SNAPSHOT_H */
File diff suppressed because it is too large Load Diff
+632 -107
View File
@@ -1,5 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,147 +13,673 @@
* limitations under the License.
*/
#ifndef CONFIG_H
#define CONFIG_H
#ifndef JERRYSCRIPT_CONFIG_H
#define JERRYSCRIPT_CONFIG_H
// @JERRY_BUILD_CFG@
/**
* Limit of data (system heap, engine's data except engine's own heap)
*/
#define CONFIG_MEM_DATA_LIMIT_MINUS_HEAP_SIZE (1024)
/**
* Limit of stack size
*/
#define CONFIG_MEM_STACK_LIMIT (4096)
/**
* Size of pool chunk
* Built-in configurations
*
* Should not be less than size of any of ECMA Object Model's data types.
* Allowed values for built-in defines:
* 0: Disable the given built-in.
* 1: Enable the given built-in.
*/
#define CONFIG_MEM_POOL_CHUNK_SIZE (8)
/*
* By default all built-ins are enabled if they are not defined.
*/
#ifndef JERRY_BUILTINS
#define JERRY_BUILTINS 1
#endif /* !defined (JERRY_BUILTINS) */
#ifndef JERRY_BUILTIN_ANNEXB
#define JERRY_BUILTIN_ANNEXB JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_ANNEXB) */
#ifndef JERRY_BUILTIN_ARRAY
#define JERRY_BUILTIN_ARRAY JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_ARRAY) */
#ifndef JERRY_BUILTIN_BOOLEAN
#define JERRY_BUILTIN_BOOLEAN JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_BOOLEAN) */
#ifndef JERRY_BUILTIN_DATE
#define JERRY_BUILTIN_DATE JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_DATE) */
#ifndef JERRY_BUILTIN_ERRORS
#define JERRY_BUILTIN_ERRORS JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_ERRORS) */
#ifndef JERRY_BUILTIN_JSON
#define JERRY_BUILTIN_JSON JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_JSON) */
#ifndef JERRY_BUILTIN_MATH
#define JERRY_BUILTIN_MATH JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_MATH) */
#ifndef JERRY_BUILTIN_NUMBER
#define JERRY_BUILTIN_NUMBER JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_NUMBER) */
#ifndef JERRY_BUILTIN_REGEXP
#define JERRY_BUILTIN_REGEXP JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_REGEXP) */
#ifndef JERRY_BUILTIN_STRING
#define JERRY_BUILTIN_STRING JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_STRING) */
#ifndef JERRY_BUILTIN_BIGINT
#define JERRY_BUILTIN_BIGINT JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_BIGINT) */
#ifndef JERRY_BUILTIN_CONTAINER
#define JERRY_BUILTIN_CONTAINER JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_CONTAINER) */
#ifndef JERRY_BUILTIN_DATAVIEW
#define JERRY_BUILTIN_DATAVIEW JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_DATAVIEW) */
#ifndef JERRY_BUILTIN_GLOBAL_THIS
#define JERRY_BUILTIN_GLOBAL_THIS JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_GLOBAL_THIS) */
#ifndef JERRY_BUILTIN_PROXY
#define JERRY_BUILTIN_PROXY JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_PROXY) */
#ifndef JERRY_BUILTIN_REALMS
#define JERRY_BUILTIN_REALMS JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_REALMS) */
#ifndef JERRY_BUILTIN_REFLECT
#define JERRY_BUILTIN_REFLECT JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_REFLECT) */
#ifndef JERRY_BUILTIN_TYPEDARRAY
#define JERRY_BUILTIN_TYPEDARRAY JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_TYPEDARRAY) */
#ifndef JERRY_BUILTIN_SHAREDARRAYBUFFER
#define JERRY_BUILTIN_SHAREDARRAYBUFFER JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_SHAREDARRAYBUFFER) */
#ifndef JERRY_BUILTIN_ATOMICS
#define JERRY_BUILTIN_ATOMICS JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_ATOMICS) */
#ifndef JERRY_BUILTIN_WEAKREF
#define JERRY_BUILTIN_WEAKREF JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_WEAKREF) */
#ifndef JERRY_MODULE_SYSTEM
#define JERRY_MODULE_SYSTEM JERRY_BUILTINS
#endif /* !defined (JERRY_MODULE_SYSTEM) */
/**
* Size of heap
* Engine internal and misc configurations.
*/
#ifndef CONFIG_MEM_HEAP_AREA_SIZE
# define CONFIG_MEM_HEAP_AREA_SIZE (512 * 1024)
#elif CONFIG_MEM_HEAP_AREA_SIZE > (512 * 1024)
# error "Currently, maximum 512 kilobytes heap size is supported"
#endif /* !CONFIG_MEM_HEAP_AREA_SIZE */
/**
* Max heap usage limit
*/
#define CONFIG_MEM_HEAP_MAX_LIMIT 8192
/**
* Desired limit of heap usage
*/
#define CONFIG_MEM_HEAP_DESIRED_LIMIT (JERRY_MIN (CONFIG_MEM_HEAP_AREA_SIZE / 32, CONFIG_MEM_HEAP_MAX_LIMIT))
/**
* Log2 of maximum possible offset in the heap
* Specifies the compressed pointer representation
*
* The option affects size of compressed pointer that in turn
* affects size of ECMA Object Model's data types.
* Allowed values:
* 0: use 16 bit representation
* 1: use 32 bit representation
*
* In any case size of any of the types should not exceed CONFIG_MEM_POOL_CHUNK_SIZE.
*
* On the other hand, value 2 ^ CONFIG_MEM_HEAP_OFFSET_LOG should not be less than CONFIG_MEM_HEAP_AREA_SIZE.
* Default value: 0
* For more details see: jmem/jmem.h
*/
#define CONFIG_MEM_HEAP_OFFSET_LOG (19)
#ifndef JERRY_CPOINTER_32_BIT
#define JERRY_CPOINTER_32_BIT 0
#endif /* !defined (JERRY_CPOINTER_32_BIT) */
/**
* Number of lower bits in key of literal hash table.
* Enable/Disable the engine's JavaScript debugger interface
*
* Allowed values:
* 0: Disable the debugger parts.
* 1: Enable the debugger.
*/
#define CONFIG_LITERAL_HASH_TABLE_KEY_BITS (7)
#ifndef JERRY_DEBUGGER
#define JERRY_DEBUGGER 0
#endif /* !defined (JERRY_DEBUGGER) */
/**
* Width of fields used for holding counter of references to ecma-strings and ecma-objects
* Enable/Disable built-in error messages for error objects.
*
* The option affects maximum number of simultaneously existing:
* - references to one string;
* - stack references to one object
* The number is ((2 ^ CONFIG_ECMA_REFERENCE_COUNTER_WIDTH) - 1).
* Allowed values:
* 0: Disable error messages.
* 1: Enable error message.
*
* Also the option affects size of ECMA Object Model's data types.
* In any case size of any of the types should not exceed CONFIG_MEM_POOL_CHUNK_SIZE.
* Default value: 0
*/
#define CONFIG_ECMA_REFERENCE_COUNTER_WIDTH (12)
#ifndef JERRY_ERROR_MESSAGES
#define JERRY_ERROR_MESSAGES 0
#endif /* !defined (JERRY_ERROR_MESSAGES) */
#define CONFIG_ECMA_REFERENCE_COUNTER_LIMIT ((1u << CONFIG_ECMA_REFERENCE_COUNTER_WIDTH) - 1u)
/**
* Enable/Disable external context.
*
* Allowed values:
* 0: Disable external context.
* 1: Enable external context support.
*
* Default value: 0
*/
#ifndef JERRY_EXTERNAL_CONTEXT
#define JERRY_EXTERNAL_CONTEXT 0
#endif /* !defined (JERRY_EXTERNAL_CONTEXT) */
/**
* Maximum size of heap in kilobytes
*
* Default value: 512 KiB
*/
#ifndef JERRY_GLOBAL_HEAP_SIZE
#define JERRY_GLOBAL_HEAP_SIZE (512)
#endif /* !defined (JERRY_GLOBAL_HEAP_SIZE) */
/**
* The allowed heap usage limit until next garbage collection, in bytes.
*
* If value is 0, the default is 1/32 of JERRY_HEAP_SIZE
*/
#ifndef JERRY_GC_LIMIT
#define JERRY_GC_LIMIT 0
#endif /* !defined (JERRY_GC_LIMIT) */
/**
* Maximum stack usage size in kilobytes
*
* Note: This feature cannot be used when 'detect_stack_use_after_return=1' ASAN option is enabled.
* For more detailed description:
* - https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn#compatibility
*
* Default value: 0, unlimited
*/
#ifndef JERRY_STACK_LIMIT
#define JERRY_STACK_LIMIT (0)
#endif /* !defined (JERRY_STACK_LIMIT) */
/**
* Maximum depth of recursion during GC mark phase
*
* Default value: 8
*/
#ifndef JERRY_GC_MARK_LIMIT
#define JERRY_GC_MARK_LIMIT (8)
#endif /* !defined (JERRY_GC_MARK_LIMIT) */
/**
* Enable/Disable property lookup cache.
*
* Allowed values:
* 0: Disable lookup cache.
* 1: Enable lookup cache.
*
* Default value: 1
*/
#ifndef JERRY_LCACHE
#define JERRY_LCACHE 1
#endif /* !defined (JERRY_LCACHE) */
/**
* Enable/Disable function toString operation.
*
* Allowed values:
* 0: Disable function toString operation.
* 1: Enable function toString operation.
*
* Default value: 0
*/
#ifndef JERRY_FUNCTION_TO_STRING
#define JERRY_FUNCTION_TO_STRING 0
#endif /* !defined (JERRY_FUNCTION_TO_STRING) */
/**
* Enable/Disable line-info management inside the engine.
*
* Allowed values:
* 0: Disable line-info in the engine.
* 1: Enable line-info management.
*
* Default value: 0
*/
#ifndef JERRY_LINE_INFO
#define JERRY_LINE_INFO 0
#endif /* !defined (JERRY_LINE_INFO) */
/**
* Enable/Disable logging inside the engine.
*
* Allowed values:
* 0: Disable internal logging.
* 1: Enable internal logging.
*
* Default value: 0
*/
#ifndef JERRY_LOGGING
#define JERRY_LOGGING 0
#endif /* !defined (JERRY_LOGGING) */
/**
* Enable/Disable gc call before every allocation.
*
* Allowed values:
* 0: Disable gc call before each allocation.
* 1: Enable and force gc call before each allocation.
*
* Default value: 0
* Warning!: This is an advanced option and will slow down the engine!
* Only enable it for debugging purposes.
*/
#ifndef JERRY_MEM_GC_BEFORE_EACH_ALLOC
#define JERRY_MEM_GC_BEFORE_EACH_ALLOC 0
#endif /* !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) */
/**
* Enable/Disable the collection if run-time memory statistics.
*
* Allowed values:
* 0: Disable run-time memory information collection.
* 1: Enable run-time memory statistics collection.
*
* Default value: 0
*/
#ifndef JERRY_MEM_STATS
#define JERRY_MEM_STATS 0
#endif /* !defined (JERRY_MEM_STATS) */
/**
* Use 32-bit/64-bit float for ecma-numbers
*/
#define CONFIG_ECMA_NUMBER_FLOAT32 (1u) /* 32-bit float */
#define CONFIG_ECMA_NUMBER_FLOAT64 (2u) /* 64-bit float */
#ifndef CONFIG_ECMA_NUMBER_TYPE
# define CONFIG_ECMA_NUMBER_TYPE CONFIG_ECMA_NUMBER_FLOAT64
#else /* CONFIG_ECMA_NUMBER_TYPE */
# if (CONFIG_ECMA_NUMBER_TYPE != CONFIG_ECMA_NUMBER_FLOAT32 \
&& CONFIG_ECMA_NUMBER_TYPE != CONFIG_ECMA_NUMBER_FLOAT64)
# error "ECMA-number storage is configured incorrectly"
# endif /* CONFIG_ECMA_NUMBER_TYPE != CONFIG_ECMA_NUMBER_FLOAT32
&& CONFIG_ECMA_NUMBER_TYPE != CONFIG_ECMA_NUMBER_FLOAT64 */
#endif /* !CONFIG_ECMA_NUMBER_TYPE */
/**
* Representation for ecma-characters
*/
#define CONFIG_ECMA_CHAR_ASCII (1) /* ASCII */
#define CONFIG_ECMA_CHAR_UTF16 (2) /* UTF-16 */
#ifndef CONFIG_ECMA_CHAR_ENCODING
# define CONFIG_ECMA_CHAR_ENCODING CONFIG_ECMA_CHAR_ASCII
#else /* CONFIG_ECMA_CHAR_ENCODING */
# if (CONFIG_ECMA_CHAR_ENCODING != CONFIG_ECMA_CHAR_ASCII \
&& CONFIG_ECMA_CHAR_ENCODING != CONFIG_ECMA_CHAR_UTF16)
# error "ECMA-char encoding is configured incorrectly"
# endif /* CONFIG_ECMA_CHAR_ENCODING != CONFIG_ECMA_CHAR_ASCII
&& CONFIG_ECMA_CHAR_ENCODING != CONFIG_ECMA_CHAR_UTF16 */
#endif /* !CONFIG_ECMA_CHAR_ENCODING */
/**
* Disable ECMA lookup cache
*/
// #define CONFIG_ECMA_LCACHE_DISABLE
/**
* Disable ECMA property hashmap
*/
// #define CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
/**
* Share of newly allocated since last GC objects among all currently allocated objects,
* after achieving which, GC is started upon low severity try-give-memory-back requests.
* This option is for expert use only!
*
* Share is calculated as the following:
* 1.0 / CONFIG_ECMA_GC_NEW_OBJECTS_SHARE_TO_START_GC
* Allowed values:
* 1: use 64-bit floating point number mode
* 0: use 32-bit floating point number mode
*
* Default value: 1
*/
#define CONFIG_ECMA_GC_NEW_OBJECTS_SHARE_TO_START_GC (16)
#ifndef JERRY_NUMBER_TYPE_FLOAT64
#define JERRY_NUMBER_TYPE_FLOAT64 1
#endif /* !defined (JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Link Global Environment to an empty declarative lexical environment
* instead of lexical environment bound to Global Object.
* Enable/Disable the JavaScript parser.
*
* Allowed values:
* 0: Disable the JavaScript parser and all related functionallity.
* 1: Enable the JavaScript parser.
*
* Default value: 1
*/
// #define CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE
#ifndef JERRY_PARSER
#define JERRY_PARSER 1
#endif /* !defined (JERRY_PARSER) */
/**
* Number of ecma values inlined into VM stack frame
* Enable/Disable JerryScript byte code dump functions during parsing.
* To dump the JerryScript byte code the engine must be initialized with opcodes
* display flag. This option does not influence RegExp byte code dumps.
*
* Allowed values:
* 0: Disable all bytecode dump functions.
* 1: Enable bytecode dump functions.
*
* Default value: 0
*/
#define CONFIG_VM_STACK_FRAME_INLINED_VALUES_NUMBER (16)
#ifndef JERRY_PARSER_DUMP_BYTE_CODE
#define JERRY_PARSER_DUMP_BYTE_CODE 0
#endif /* defined (JERRY_PARSER_DUMP_BYTE_CODE) */
/**
* Run GC after execution of each byte-code instruction
* Enable/Disable ECMA property hashmap.
*
* Allowed values:
* 0: Disable property hasmap.
* 1: Enable property hashmap.
*
* Default value: 1
*/
// #define CONFIG_VM_RUN_GC_AFTER_EACH_OPCODE
#ifndef JERRY_PROPERTY_HASHMAP
#define JERRY_PROPERTY_HASHMAP 1
#endif /* !defined (JERRY_PROPERTY_HASHMAP) */
/**
* Flag, indicating whether to enable parser-time byte-code optimizations
* Enables/disables the Promise event callbacks
*
* Default value: 0
*/
#define CONFIG_PARSER_ENABLE_PARSE_TIME_BYTE_CODE_OPTIMIZER
#ifndef JERRY_PROMISE_CALLBACK
#define JERRY_PROMISE_CALLBACK 0
#endif /* !defined (JERRY_PROMISE_CALLBACK) */
#endif /* !CONFIG_H */
/**
* Enable/Disable byte code dump functions for RegExp objects.
* To dump the RegExp byte code the engine must be initialized with
* regexp opcodes display flag. This option does not influence the
* JerryScript byte code dumps.
*
* Allowed values:
* 0: Disable all bytecode dump functions.
* 1: Enable bytecode dump functions.
*
* Default value: 0
*/
#ifndef JERRY_REGEXP_DUMP_BYTE_CODE
#define JERRY_REGEXP_DUMP_BYTE_CODE 0
#endif /* !defined (JERRY_REGEXP_DUMP_BYTE_CODE) */
/**
* Enables/disables the RegExp strict mode
*
* Default value: 0
*/
#ifndef JERRY_REGEXP_STRICT_MODE
#define JERRY_REGEXP_STRICT_MODE 0
#endif /* !defined (JERRY_REGEXP_STRICT_MODE) */
/**
* Enable/Disable the snapshot execution functions.
*
* Allowed values:
* 0: Disable snapshot execution.
* 1: Enable snapshot execution.
*
* Default value: 0
*/
#ifndef JERRY_SNAPSHOT_EXEC
#define JERRY_SNAPSHOT_EXEC 0
#endif /* !defined (JERRY_SNAPSHOT_EXEC) */
/**
* Enable/Disable the snapshot save functions.
*
* Allowed values:
* 0: Disable snapshot save functions.
* 1: Enable snapshot save functions.
*/
#ifndef JERRY_SNAPSHOT_SAVE
#define JERRY_SNAPSHOT_SAVE 0
#endif /* !defined (JERRY_SNAPSHOT_SAVE) */
/**
* Enable/Disable usage of system allocator.
*
* Allowed values:
* 0: Disable usage of system allocator.
* 1: Enable usage of system allocator.
*
* Default value: 0
*/
#ifndef JERRY_SYSTEM_ALLOCATOR
#define JERRY_SYSTEM_ALLOCATOR 0
#endif /* !defined (JERRY_SYSTEM_ALLOCATOR) */
/**
* Enables/disables the unicode case conversion in the engine.
* By default Unicode case conversion is enabled.
*/
#ifndef JERRY_UNICODE_CASE_CONVERSION
#define JERRY_UNICODE_CASE_CONVERSION 1
#endif /* !defined (JERRY_UNICODE_CASE_CONVERSION) */
/**
* Configures if the internal memory allocations are exposed to Valgrind or not.
*
* Allowed values:
* 0: Disable the Valgrind specific memory allocation notifications.
* 1: Enable the Valgrind specific allocation notifications.
*/
#ifndef JERRY_VALGRIND
#define JERRY_VALGRIND 0
#endif /* !defined (JERRY_VALGRIND) */
/**
* Enable/Disable the vm execution stop callback function.
*
* Allowed values:
* 0: Disable vm exec stop callback support.
* 1: Enable vm exec stop callback support.
*/
#ifndef JERRY_VM_HALT
#define JERRY_VM_HALT 0
#endif /* !defined (JERRY_VM_HALT) */
/**
* Enable/Disable the vm throw callback function.
*
* Allowed values:
* 0: Disable vm throw callback support.
* 1: Enable vm throw callback support.
*/
#ifndef JERRY_VM_THROW
#define JERRY_VM_THROW 0
#endif /* !defined (JERRY_VM_THROW) */
/**
* Advanced section configurations.
*/
/**
* Allow configuring attributes on a few constant data inside the engine.
*
* One of the main usages:
* Normally compilers store const(ant)s in ROM. Thus saving RAM.
* But if your compiler does not support it then the directive below can force it.
*
* For the moment it is mainly meant for the following targets:
* - ESP8266
*
* Example configuration for moving (some) constatns into a given section:
* # define JERRY_ATTR_CONST_DATA __attribute__((section(".rodata.const")))
*/
#ifndef JERRY_ATTR_CONST_DATA
#define JERRY_ATTR_CONST_DATA
#endif /* !defined (JERRY_ATTR_CONST_DATA) */
/**
* The JERRY_ATTR_GLOBAL_HEAP allows adding extra attributes for the Jerry global heap.
*
* Example on how to move the global heap into it's own section:
* #define JERRY_ATTR_GLOBAL_HEAP __attribute__((section(".text.globalheap")))
*/
#ifndef JERRY_ATTR_GLOBAL_HEAP
#define JERRY_ATTR_GLOBAL_HEAP
#endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */
/**
* Sanity check for macros to see if the values are 0 or 1
*
* If a new feature is added this should be updated.
*/
/**
* Check base builtins.
*/
#if (JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1)
#error "Invalid value for JERRY_BUILTIN_ANNEXB macro."
#endif /* (JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1) */
#if (JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1)
#error "Invalid value for JERRY_BUILTIN_ARRAY macro."
#endif /* (JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1) */
#if (JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1)
#error "Invalid value for JERRY_BUILTIN_BOOLEAN macro."
#endif /* (JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1) */
#if (JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1)
#error "Invalid value for JERRY_BUILTIN_DATE macro."
#endif /* (JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1) */
#if (JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1)
#error "Invalid value for JERRY_BUILTIN_ERRORS macro."
#endif /* (JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1) */
#if (JERRY_BUILTIN_JSON != 0) && (JERRY_BUILTIN_JSON != 1)
#error "Invalid value for JERRY_BUILTIN_JSON macro."
#endif /* (JERRY_BUILTIN_JSON != 0) && (JERRY_BUILTIN_JSON != 1) */
#if (JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1)
#error "Invalid value for JERRY_BUILTIN_MATH macro."
#endif /* (JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1) */
#if (JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1)
#error "Invalid value for JERRY_BUILTIN_NUMBER macro."
#endif /* (JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1) */
#if (JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1)
#error "Invalid value for JERRY_BUILTIN_REGEXP macro."
#endif /* (JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1) */
#if (JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1)
#error "Invalid value for JERRY_BUILTIN_STRING macro."
#endif /* (JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1) */
#if (JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1)
#error "Invalid value for JERRY_BUILTINS macro."
#endif /* (JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1) */
#if (JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1)
#error "Invalid value for JERRY_BUILTIN_REALMS macro."
#endif /* (JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1) */
#if (JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1)
#error "Invalid value for JERRY_BUILTIN_DATAVIEW macro."
#endif /* (JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1) */
#if (JERRY_BUILTIN_GLOBAL_THIS != 0) && (JERRY_BUILTIN_GLOBAL_THIS != 1)
#error "Invalid value for JERRY_BUILTIN_GLOBAL_THIS macro."
#endif /* (JERRY_BUILTIN_GLOBAL_THIS != 0) && (JERRY_BUILTIN_GLOBAL_THIS != 1) */
#if (JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1)
#error "Invalid value for JERRY_BUILTIN_REFLECT macro."
#endif /* (JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1) */
#if (JERRY_BUILTIN_WEAKREF != 0) && (JERRY_BUILTIN_WEAKREF != 1)
#error "Invalid value for JERRY_BUILTIN_WEAKREF macro."
#endif /* (JERRY_BUILTIN_WEAKREF != 0) && (JERRY_BUILTIN_WEAKREF != 1) */
#if (JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1)
#error "Invalid value for JERRY_BUILTIN_PROXY macro."
#endif /* (JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1) */
#if (JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1)
#error "Invalid value for JERRY_BUILTIN_TYPEDARRAY macro."
#endif /* (JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1) */
#if (JERRY_BUILTIN_SHAREDARRAYBUFFER != 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER != 1)
#error "Invalid value for JERRY_BUILTIN_SHAREDARRAYBUFFER macro."
#endif /* (JERRY_BUILTIN_SHAREDARRAYBUFFER != 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER != 1) */
#if (JERRY_BUILTIN_ATOMICS != 0) && (JERRY_BUILTIN_ATOMICS != 1)
#error "Invalid value for JERRY_BUILTIN_ATOMICS macro."
#endif /* (JERRY_BUILTIN_ATOMICS != 0) && (JERRY_BUILTIN_ATOMICS != 1) */
#if (JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1)
#error "Invalid value for JERRY_BUILTIN_BIGINT macro."
#endif /* (JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1) */
#if (JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1)
#error "Invalid value for JERRY_MODULE_SYSTEM macro."
#endif /* (JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1) */
#if (JERRY_BUILTIN_TYPEDARRAY == 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER == 1)
#error "JERRY_BUILTIN_TYPEDARRAY should be enabled too to enable JERRY_BUILTIN_SHAREDARRAYBUFFER macro."
#endif /* (JERRY_BUILTIN_TYPEDARRAY == 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER == 1) */
#if (JERRY_BUILTIN_SHAREDARRAYBUFFER == 0) && (JERRY_BUILTIN_ATOMICS == 1)
#error "JERRY_BUILTIN_SHAREDARRAYBUFFER should be enabled too to enable JERRY_BUILTIN_ATOMICS macro."
#endif /* (JERRY_BUILTIN_SHAREDARRAYBUFFER == 0) && (JERRY_BUILTIN_ATOMICS == 1) */
/**
* Internal options.
*/
#if (JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1)
#error "Invalid value for 'JERRY_CPOINTER_32_BIT' macro."
#endif /* (JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1) */
#if (JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1)
#error "Invalid value for 'JERRY_DEBUGGER' macro."
#endif /* (JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1) */
#if (JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1)
#error "Invalid value for 'JERRY_ERROR_MESSAGES' macro."
#endif /* (JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1) */
#if (JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1)
#error "Invalid value for 'JERRY_EXTERNAL_CONTEXT' macro."
#endif /* (JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1) */
#if JERRY_GLOBAL_HEAP_SIZE <= 0
#error "Invalid value for 'JERRY_GLOBAL_HEAP_SIZE' macro."
#endif /* JERRY_GLOBAL_HEAP_SIZE <= 0 */
#if JERRY_GC_LIMIT < 0
#error "Invalid value for 'JERRY_GC_LIMIT' macro."
#endif /* JERRY_GC_LIMIT < 0 */
#if JERRY_STACK_LIMIT < 0
#error "Invalid value for 'JERRY_STACK_LIMIT' macro."
#endif /* JERRY_STACK_LIMIT < 0 */
#if JERRY_GC_MARK_LIMIT < 0
#error "Invalid value for 'JERRY_GC_MARK_LIMIT' macro."
#endif /* JERRY_GC_MARK_LIMIT < 0 */
#if (JERRY_LCACHE != 0) && (JERRY_LCACHE != 1)
#error "Invalid value for 'JERRY_LCACHE' macro."
#endif /* (JERRY_LCACHE != 0) && (JERRY_LCACHE != 1) */
#if (JERRY_FUNCTION_TO_STRING != 0) && (JERRY_FUNCTION_TO_STRING != 1)
#error "Invalid value for 'JERRY_FUNCTION_TO_STRING' macro."
#endif /* (JERRY_FUNCTION_TO_STRING != 0) && (JERRY_FUNCTION_TO_STRING != 1) */
#if (JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1)
#error "Invalid value for 'JERRY_LINE_INFO' macro."
#endif /* (JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1) */
#if (JERRY_LOGGING != 0) && (JERRY_LOGGING != 1)
#error "Invalid value for 'JERRY_LOGGING' macro."
#endif /* (JERRY_LOGGING != 0) && (JERRY_LOGGING != 1) */
#if (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1)
#error "Invalid value for 'JERRY_MEM_GC_BEFORE_EACH_ALLOC' macro."
#endif /* (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1) */
#if (JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1)
#error "Invalid value for 'JERRY_MEM_STATS' macro."
#endif /* (JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1) */
#if (JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1)
#error "Invalid value for 'JERRY_NUMBER_TYPE_FLOAT64' macro."
#endif /* (JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1) */
#if (JERRY_PARSER != 0) && (JERRY_PARSER != 1)
#error "Invalid value for 'JERRY_PARSER' macro."
#endif /* (JERRY_PARSER != 0) && (JERRY_PARSER != 1) */
#if (JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1)
#error "Invalid value for 'JERRY_PARSER_DUMP_BYTE_CODE' macro."
#endif /* (JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1) */
#if (JERRY_PROPERTY_HASHMAP != 0) && (JERRY_PROPERTY_HASHMAP != 1)
#error "Invalid value for 'JERRY_PROPERTY_HASHMAP' macro."
#endif /* (JERRY_PROPERTY_HASHMAP != 0) && (JERRY_PROPERTY_HASHMAP != 1) */
#if (JERRY_PROMISE_CALLBACK != 0) && (JERRY_PROMISE_CALLBACK != 1)
#error "Invalid value for 'JERRY_PROMISE_CALLBACK' macro."
#endif /* (JERRY_PROMISE_CALLBACK != 0) && (JERRY_PROMISE_CALLBACK != 1) */
#if (JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1)
#error "Invalid value for 'JERRY_REGEXP_DUMP_BYTE_CODE' macro."
#endif /* (JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1) */
#if (JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1)
#error "Invalid value for 'JERRY_REGEXP_STRICT_MODE' macro."
#endif /* (JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1) */
#if (JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1)
#error "Invalid value for 'JERRY_SNAPSHOT_EXEC' macro."
#endif /* (JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1) */
#if (JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1)
#error "Invalid value for 'JERRY_SNAPSHOT_SAVE' macro."
#endif /* (JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1) */
#if (JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1)
#error "Invalid value for 'JERRY_SYSTEM_ALLOCATOR' macro."
#endif /* (JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1) */
#if (JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1)
#error "Invalid value for 'JERRY_UNICODE_CASE_CONVERSION' macro."
#endif /* (JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1) */
#if (JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1)
#error "Invalid value for 'JERRY_VALGRIND' macro."
#endif /* (JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1) */
#if (JERRY_VM_HALT != 0) && (JERRY_VM_HALT != 1)
#error "Invalid value for 'JERRY_VM_HALT' macro."
#endif /* (JERRY_VM_HALT != 0) && (JERRY_VM_HALT != 1) */
#if (JERRY_VM_THROW != 0) && (JERRY_VM_THROW != 1)
#error "Invalid value for 'JERRY_VM_THROW' macro."
#endif /* (JERRY_VM_THROW != 0) && (JERRY_VM_THROW != 1) */
/**
* Cross component requirements check.
*/
/**
* The date module can only use the float 64 number types.
*/
#if JERRY_BUILTIN_DATE && !JERRY_NUMBER_TYPE_FLOAT64
#error "Date does not support float32"
#endif /* JERRY_BUILTIN_DATE && !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Source name related types into a single guard
*/
#if JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM
#define JERRY_SOURCE_NAME 1
#else /* !(JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM) */
#define JERRY_SOURCE_NAME 0
#endif /* JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM */
#endif /* !JERRYSCRIPT_CONFIG_H */
File diff suppressed because it is too large Load Diff
+488
View File
@@ -0,0 +1,488 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DEBUGGER_H
#define DEBUGGER_H
#include "jerryscript-debugger-transport.h"
#include "ecma-globals.h"
#if JERRY_DEBUGGER
/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */
/**
* Frequency of calling jerry_debugger_receive() by the VM.
*/
#define JERRY_DEBUGGER_MESSAGE_FREQUENCY 5
/**
* This constant represents that the string to be sent has no subtype.
*/
#define JERRY_DEBUGGER_NO_SUBTYPE 0
/**
* Limited resources available for the engine, so it is important to
* check the maximum buffer size. It needs to be between 64 and 256 bytes.
*/
#if JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE < 64 || JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE > 256
#error Please define the MAX_BUFFER_SIZE between 64 and 256 bytes.
#endif /* JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE < 64 || JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE > 256 */
/**
* Calculate the maximum number of items for a given type
* which can be transmitted in one message.
*/
#define JERRY_DEBUGGER_SEND_MAX(type) \
((size_t) ((JERRY_CONTEXT (debugger_max_send_size) - sizeof (jerry_debugger_send_type_t)) / sizeof (type)))
/**
* Calculate the size of a message when a count number of items transmitted.
*/
#define JERRY_DEBUGGER_SEND_SIZE(count, type) ((size_t) ((count * sizeof (type)) + sizeof (jerry_debugger_send_type_t)))
/**
* Debugger operation modes:
*
* The debugger has two operation modes: run mode and breakpoint mode.
*
* In run mode the debugger server accepts only a limited number of message
* types from the debugger client (e.g. stop execution, set breakpoint).
*
* In breakpoint mode the JavaScript execution is stopped at a breakpoint and
* more message types are accepted (e.g. get backtrace, evaluate expression).
*
* Switching between modes:
*
* When the JavaScript execution stops at a breakpoint the server sends a
* JERRY_DEBUGGER_BREAKPOINT_HIT message to the client. The client can only
* issue breakpoint mode commands after this message is received.
*
* Certain breakpoint mode commands (e.g. continue) resumes the JavaScript
* execution and the client must not send any breakpoint mode messages
* until the JERRY_DEBUGGER_BREAKPOINT_HIT is received again.
*
* The debugger server starts in run mode but stops at the first available
* breakpoint.
*/
/**
* Debugger option flags.
*/
typedef enum
{
JERRY_DEBUGGER_CONNECTED = 1u << 0, /**< debugger is connected */
JERRY_DEBUGGER_BREAKPOINT_MODE = 1u << 1, /**< debugger waiting at a breakpoint */
JERRY_DEBUGGER_VM_STOP = 1u << 2, /**< stop at the next breakpoint even if disabled */
JERRY_DEBUGGER_VM_IGNORE = 1u << 3, /**< ignore all breakpoints */
JERRY_DEBUGGER_VM_IGNORE_EXCEPTION = 1u << 4, /**< debugger doesn't stop at any exception */
JERRY_DEBUGGER_VM_EXCEPTION_THROWN = 1u << 5, /**< no need to stop for this exception */
JERRY_DEBUGGER_PARSER_WAIT = 1u << 6, /**< debugger should wait after parsing is completed */
JERRY_DEBUGGER_PARSER_WAIT_MODE = 1u << 7, /**< debugger is waiting after parsing is completed */
JERRY_DEBUGGER_CLIENT_SOURCE_MODE = 1u << 8, /**< debugger waiting for client code */
JERRY_DEBUGGER_CLIENT_NO_SOURCE = 1u << 9, /**< debugger leaving the client source loop */
JERRY_DEBUGGER_CONTEXT_RESET_MODE = 1u << 10, /**< debugger and engine reinitialization mode */
} jerry_debugger_flags_t;
/**
* Set debugger flags.
*/
#define JERRY_DEBUGGER_SET_FLAGS(flags) \
JERRY_CONTEXT (debugger_flags) = (JERRY_CONTEXT (debugger_flags) | (uint32_t) (flags))
/**
* Clear debugger flags.
*/
#define JERRY_DEBUGGER_CLEAR_FLAGS(flags) \
JERRY_CONTEXT (debugger_flags) = (JERRY_CONTEXT (debugger_flags) & (uint32_t) ~(flags))
/**
* Set and clear debugger flags.
*/
#define JERRY_DEBUGGER_UPDATE_FLAGS(flags_to_set, flags_to_clear) \
JERRY_CONTEXT (debugger_flags) = \
((JERRY_CONTEXT (debugger_flags) | (uint32_t) (flags_to_set)) & (uint32_t) ~(flags_to_clear))
/**
* Types for the package.
*/
typedef enum
{
/* Messages sent by the server to client. */
/* This is a handshake message, sent once during initialization. */
JERRY_DEBUGGER_CONFIGURATION = 1, /**< debugger configuration */
/* These messages are sent by the parser. */
JERRY_DEBUGGER_PARSE_ERROR = 2, /**< parse error */
JERRY_DEBUGGER_BYTE_CODE_CP = 3, /**< byte code compressed pointer */
JERRY_DEBUGGER_PARSE_FUNCTION = 4, /**< parsing a new function */
JERRY_DEBUGGER_BREAKPOINT_LIST = 5, /**< list of line offsets */
JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST = 6, /**< list of byte code offsets */
JERRY_DEBUGGER_SOURCE_CODE = 7, /**< source code fragment */
JERRY_DEBUGGER_SOURCE_CODE_END = 8, /**< source code last fragment */
JERRY_DEBUGGER_SOURCE_CODE_NAME = 9, /**< source code name fragment */
JERRY_DEBUGGER_SOURCE_CODE_NAME_END = 10, /**< source code name last fragment */
JERRY_DEBUGGER_FUNCTION_NAME = 11, /**< function name fragment */
JERRY_DEBUGGER_FUNCTION_NAME_END = 12, /**< function name last fragment */
JERRY_DEBUGGER_WAITING_AFTER_PARSE = 13, /**< engine waiting for a parser resume */
/* These messages are generic messages. */
JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP = 14, /**< invalidate byte code compressed pointer */
JERRY_DEBUGGER_MEMSTATS_RECEIVE = 15, /**< memstats sent to the client */
JERRY_DEBUGGER_BREAKPOINT_HIT = 16, /**< notify breakpoint hit */
JERRY_DEBUGGER_EXCEPTION_HIT = 17, /**< notify exception hit */
JERRY_DEBUGGER_EXCEPTION_STR = 18, /**< exception string fragment */
JERRY_DEBUGGER_EXCEPTION_STR_END = 19, /**< exception string last fragment */
JERRY_DEBUGGER_BACKTRACE_TOTAL = 20, /**< number of total frames */
JERRY_DEBUGGER_BACKTRACE = 21, /**< backtrace data */
JERRY_DEBUGGER_BACKTRACE_END = 22, /**< last backtrace data */
JERRY_DEBUGGER_EVAL_RESULT = 23, /**< eval result */
JERRY_DEBUGGER_EVAL_RESULT_END = 24, /**< last part of eval result */
JERRY_DEBUGGER_WAIT_FOR_SOURCE = 25, /**< engine waiting for source code */
JERRY_DEBUGGER_OUTPUT_RESULT = 26, /**< output sent by the program to the debugger */
JERRY_DEBUGGER_OUTPUT_RESULT_END = 27, /**< last output result data */
JERRY_DEBUGGER_SCOPE_CHAIN = 28, /**< scope chain */
JERRY_DEBUGGER_SCOPE_CHAIN_END = 29, /**< last output of scope chain */
JERRY_DEBUGGER_SCOPE_VARIABLES = 30, /**< scope variables */
JERRY_DEBUGGER_SCOPE_VARIABLES_END = 31, /**< last output of scope variables */
JERRY_DEBUGGER_CLOSE_CONNECTION = 32, /**< close connection with the client */
JERRY_DEBUGGER_MESSAGES_OUT_MAX_COUNT, /**< number of different type of output messages by the debugger */
/* Messages sent by the client to server. */
/* The following messages are accepted in both run and breakpoint modes. */
JERRY_DEBUGGER_FREE_BYTE_CODE_CP = 1, /**< free byte code compressed pointer */
JERRY_DEBUGGER_UPDATE_BREAKPOINT = 2, /**< update breakpoint status */
JERRY_DEBUGGER_EXCEPTION_CONFIG = 3, /**< exception handler config */
JERRY_DEBUGGER_PARSER_CONFIG = 4, /**< parser config */
JERRY_DEBUGGER_MEMSTATS = 5, /**< list memory statistics */
JERRY_DEBUGGER_STOP = 6, /**< stop execution */
/* The following message is only available in waiting after parse mode. */
JERRY_DEBUGGER_PARSER_RESUME = 7, /**< stop waiting after parse */
/* The following four messages are only available in client switch mode. */
JERRY_DEBUGGER_CLIENT_SOURCE = 8, /**< first message of client source */
JERRY_DEBUGGER_CLIENT_SOURCE_PART = 9, /**< next message of client source */
JERRY_DEBUGGER_NO_MORE_SOURCES = 10, /**< no more sources notification */
JERRY_DEBUGGER_CONTEXT_RESET = 11, /**< context reset request */
/* The following messages are only available in breakpoint
* mode and they switch the engine to run mode. */
JERRY_DEBUGGER_CONTINUE = 12, /**< continue execution */
JERRY_DEBUGGER_STEP = 13, /**< next breakpoint, step into functions */
JERRY_DEBUGGER_NEXT = 14, /**< next breakpoint in the same context */
JERRY_DEBUGGER_FINISH = 15, /**< Continue running just after the function in the current stack frame returns */
/* The following messages are only available in breakpoint
* mode and this mode is kept after the message is processed. */
JERRY_DEBUGGER_GET_BACKTRACE = 16, /**< get backtrace */
JERRY_DEBUGGER_EVAL = 17, /**< first message of evaluating a string */
JERRY_DEBUGGER_EVAL_PART = 18, /**< next message of evaluating a string */
JERRY_DEBUGGER_GET_SCOPE_CHAIN = 19, /**< get type names of the scope chain */
JERRY_DEBUGGER_GET_SCOPE_VARIABLES = 20, /**< get variables of a scope */
JERRY_DEBUGGER_MESSAGES_IN_MAX_COUNT, /**< number of different type of input messages */
} jerry_debugger_header_type_t;
/**
* Debugger option flags.
*/
typedef enum
{
JERRY_DEBUGGER_LITTLE_ENDIAN = 1u << 0, /**< little endian */
} jerry_debugger_configuration_flags_t;
/**
* Subtypes of eval.
*/
typedef enum
{
JERRY_DEBUGGER_EVAL_EVAL = 0, /**< evaluate expression */
JERRY_DEBUGGER_EVAL_THROW = 1, /**< evaluate expression and throw the result */
JERRY_DEBUGGER_EVAL_ABORT = 2, /**< evaluate expression and abrot with the result */
} jerry_debugger_eval_type_t;
/**
* Subtypes of eval_result.
*/
typedef enum
{
JERRY_DEBUGGER_EVAL_OK = 1, /**< eval result, no error */
JERRY_DEBUGGER_EVAL_ERROR = 2, /**< eval result when an error has occurred */
} jerry_debugger_eval_result_type_t;
/**
* Subtypes of output_result.
*
* Note:
* This enum has to be kept in sync with jerry_log_level_t with an offset
* of +2.
*/
typedef enum
{
JERRY_DEBUGGER_OUTPUT_PRINT = 1, /**< printed output */
JERRY_DEBUGGER_OUTPUT_LOG = 2, /**< logged output */
} jerry_debugger_output_subtype_t;
/**
* Types of scopes.
*/
typedef enum
{
JERRY_DEBUGGER_SCOPE_WITH = 1, /**< with */
JERRY_DEBUGGER_SCOPE_LOCAL = 2, /**< local */
JERRY_DEBUGGER_SCOPE_CLOSURE = 3, /**< closure */
JERRY_DEBUGGER_SCOPE_GLOBAL = 4, /**< global */
JERRY_DEBUGGER_SCOPE_NON_CLOSURE = 5 /**< non closure */
} jerry_debugger_scope_chain_type_t;
/**
* Type of scope variables.
*/
typedef enum
{
JERRY_DEBUGGER_VALUE_NONE = 1,
JERRY_DEBUGGER_VALUE_UNDEFINED = 2,
JERRY_DEBUGGER_VALUE_NULL = 3,
JERRY_DEBUGGER_VALUE_BOOLEAN = 4,
JERRY_DEBUGGER_VALUE_NUMBER = 5,
JERRY_DEBUGGER_VALUE_STRING = 6,
JERRY_DEBUGGER_VALUE_FUNCTION = 7,
JERRY_DEBUGGER_VALUE_ARRAY = 8,
JERRY_DEBUGGER_VALUE_OBJECT = 9
} jerry_debugger_scope_variable_type_t;
/**
* Byte data for evaluating expressions and receiving client source.
*/
typedef struct
{
uint32_t uint8_size; /**< total size of the client source */
uint32_t uint8_offset; /**< current offset in the client source */
} jerry_debugger_uint8_data_t;
/**
* Delayed free of byte code data.
*/
typedef struct
{
uint16_t size; /**< size of the byte code header divided by JMEM_ALIGNMENT */
jmem_cpointer_t prev_cp; /**< previous byte code data to be freed */
} jerry_debugger_byte_code_free_t;
/**
* Outgoing message: JerryScript configuration.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t configuration; /**< configuration option bits */
uint8_t version[sizeof (uint32_t)]; /**< debugger version */
uint8_t max_message_size; /**< maximum incoming message size */
uint8_t cpointer_size; /**< size of compressed pointers */
} jerry_debugger_send_configuration_t;
/**
* Outgoing message: message without arguments.
*/
typedef struct
{
uint8_t type; /**< type of the message */
} jerry_debugger_send_type_t;
/**
* Incoming message: message without arguments.
*/
typedef struct
{
uint8_t type; /**< type of the message */
} jerry_debugger_receive_type_t;
/**
* Outgoing message: string (Source file name or function name).
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t string[]; /**< string data */
} jerry_debugger_send_string_t;
/**
* Outgoing message: uint32 value.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t line[sizeof (uint32_t)]; /**< value data */
uint8_t column[sizeof (uint32_t)]; /**< value data */
} jerry_debugger_send_parse_function_t;
/**
* Outgoing message: byte code compressed pointer.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */
} jerry_debugger_send_byte_code_cp_t;
/**
* Incoming message: byte code compressed pointer.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */
} jerry_debugger_receive_byte_code_cp_t;
/**
* Incoming message: update (enable/disable) breakpoint status.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t is_set_breakpoint; /**< set or clear breakpoint */
uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */
uint8_t offset[sizeof (uint32_t)]; /**< breakpoint offset */
} jerry_debugger_receive_update_breakpoint_t;
/**
* Outgoing message: send memory statistics
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t allocated_bytes[sizeof (uint32_t)]; /**< allocated bytes */
uint8_t byte_code_bytes[sizeof (uint32_t)]; /**< byte code bytes */
uint8_t string_bytes[sizeof (uint32_t)]; /**< string bytes */
uint8_t object_bytes[sizeof (uint32_t)]; /**< object bytes */
uint8_t property_bytes[sizeof (uint32_t)]; /**< property bytes */
} jerry_debugger_send_memstats_t;
/**
* Outgoing message: notify breakpoint hit.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */
uint8_t offset[sizeof (uint32_t)]; /**< breakpoint offset */
} jerry_debugger_send_breakpoint_hit_t;
/**
* Stack frame descriptor for sending backtrace information.
*/
typedef struct
{
uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */
uint8_t offset[sizeof (uint32_t)]; /**< last breakpoint offset */
} jerry_debugger_frame_t;
/**
* Outgoing message: backtrace information.
*/
typedef struct
{
uint8_t type; /**< type of the message */
jerry_debugger_frame_t frames[]; /**< frames */
} jerry_debugger_send_backtrace_t;
/**
* Outgoing message: scope chain.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t scope_types[]; /**< scope types */
} jerry_debugger_send_scope_chain_t;
/**
* Outgoing message: number of total frames in backtrace.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t frame_count[sizeof (uint32_t)]; /**< total number of frames */
} jerry_debugger_send_backtrace_total_t;
/**
* Incoming message: set behaviour when exception occures.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t enable; /**< non-zero: enable stop at exception */
} jerry_debugger_receive_exception_config_t;
/**
* Incoming message: set parser configuration.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t enable_wait; /**< non-zero: wait after parsing is completed */
} jerry_debugger_receive_parser_config_t;
/**
* Incoming message: get backtrace.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t min_depth[sizeof (uint32_t)]; /**< minimum depth*/
uint8_t max_depth[sizeof (uint32_t)]; /**< maximum depth (0 - unlimited) */
uint8_t get_total_frame_count; /**< non-zero: if total frame count is also requested */
} jerry_debugger_receive_get_backtrace_t;
/**
* Incoming message: first message of evaluating expression.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t eval_size[sizeof (uint32_t)]; /**< total size of the message */
} jerry_debugger_receive_eval_first_t;
/**
* Incoming message: get scope variables
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t chain_index[sizeof (uint32_t)]; /**< index element of the scope */
} jerry_debugger_receive_get_scope_variables_t;
/**
* Incoming message: first message of client source.
*/
typedef struct
{
uint8_t type; /**< type of the message */
uint8_t code_size[sizeof (uint32_t)]; /**< total size of the message */
} jerry_debugger_receive_client_source_first_t;
void jerry_debugger_free_unreferenced_byte_code (void);
bool jerry_debugger_receive (jerry_debugger_uint8_data_t **message_data_p);
void jerry_debugger_breakpoint_hit (uint8_t message_type);
void jerry_debugger_send_type (jerry_debugger_header_type_t type);
bool jerry_debugger_send_configuration (uint8_t max_message_size);
void jerry_debugger_send_data (jerry_debugger_header_type_t type, const void *data, size_t size);
bool jerry_debugger_send_string (uint8_t message_type, uint8_t sub_type, const uint8_t *string_p, size_t string_length);
bool jerry_debugger_send_function_cp (jerry_debugger_header_type_t type, ecma_compiled_code_t *compiled_code_p);
bool jerry_debugger_send_parse_function (uint32_t line, uint32_t column);
void jerry_debugger_send_memstats (void);
bool jerry_debugger_send_exception_string (ecma_value_t exception_value);
#endif /* JERRY_DEBUGGER */
#endif /* !DEBUGGER_H */
+183 -55
View File
@@ -1,5 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,32 +14,20 @@
*/
#include "ecma-alloc.h"
#include "ecma-globals.h"
#include "ecma-gc.h"
#include "ecma-lcache.h"
#include "ecma-globals.h"
#include "jmem.h"
#include "jrt.h"
#include "jmem-poolman.h"
JERRY_STATIC_ASSERT (sizeof (ecma_property_value_t) == sizeof (ecma_value_t),
size_of_ecma_property_value_t_must_be_equal_to_size_of_ecma_value_t);
JERRY_STATIC_ASSERT (((sizeof (ecma_property_value_t) - 1) & sizeof (ecma_property_value_t)) == 0,
size_of_ecma_property_value_t_must_be_power_of_2);
JERRY_STATIC_ASSERT (sizeof (ecma_property_pair_t) == sizeof (uint64_t) * 2,
size_of_ecma_property_pair_t_must_be_equal_to_16_bytes);
JERRY_STATIC_ASSERT (sizeof (ecma_object_t) <= sizeof (uint64_t),
size_of_ecma_object_t_must_be_less_than_or_equal_to_8_bytes);
JERRY_STATIC_ASSERT (sizeof (ecma_extended_object_t) <= sizeof (uint64_t) * 2,
size_of_ecma_extended_object_t_must_be_less_than_or_equal_to_16_bytes);
JERRY_STATIC_ASSERT (sizeof (ecma_collection_header_t) == sizeof (uint64_t),
size_of_ecma_collection_header_t_must_be_less_than_or_equal_to_8_bytes);
JERRY_STATIC_ASSERT (sizeof (ecma_collection_chunk_t) == sizeof (uint64_t),
size_of_ecma_collection_chunk_t_must_be_less_than_or_equal_to_8_bytes);
JERRY_STATIC_ASSERT (sizeof (ecma_string_t) == sizeof (uint64_t),
size_of_ecma_string_t_must_be_less_than_or_equal_to_8_bytes);
JERRY_STATIC_ASSERT (sizeof (ecma_getter_setter_pointers_t) <= sizeof (uint64_t),
size_of_ecma_getter_setter_pointers_t_must_be_less_than_or_equal_to_8_bytes);
JERRY_STATIC_ASSERT (sizeof (ecma_extended_object_t) - sizeof (ecma_object_t) <= sizeof (uint64_t),
size_of_ecma_extended_object_part_must_be_less_than_or_equal_to_8_bytes);
/** \addtogroup ecma ECMA
* @{
@@ -62,79 +49,220 @@ JERRY_STATIC_ASSERT (sizeof (ecma_getter_setter_pointers_t) <= sizeof (uint64_t)
*/
/**
* Template of an allocation routine.
* Allocate memory for ecma-number
*
* @return pointer to allocated memory
*/
#define ALLOC(ecma_type) ecma_ ## ecma_type ## _t * \
ecma_alloc_ ## ecma_type (void) \
{ \
ecma_ ## ecma_type ## _t *p ## ecma_type = (ecma_ ## ecma_type ## _t *) jmem_pools_alloc (); \
\
JERRY_ASSERT (p ## ecma_type != NULL); \
\
return p ## ecma_type; \
}
extern inline ecma_number_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_number (void)
{
return (ecma_number_t *) jmem_pools_alloc (sizeof (ecma_number_t));
} /* ecma_alloc_number */
/**
* Deallocation routine template
* Dealloc memory from an ecma-number
*/
#define DEALLOC(ecma_type) void \
ecma_dealloc_ ## ecma_type (ecma_ ## ecma_type ## _t *p ## ecma_type) \
{ \
jmem_pools_free ((uint8_t *) p ## ecma_type); \
}
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_number (ecma_number_t *number_p) /**< number to be freed */
{
jmem_pools_free ((uint8_t *) number_p, sizeof (ecma_number_t));
} /* ecma_dealloc_number */
/**
* Declaration of alloc/free routine for specified ecma-type.
* Allocate memory for ecma-object
*
* @return pointer to allocated memory
*/
#define DECLARE_ROUTINES_FOR(ecma_type) \
ALLOC (ecma_type) \
DEALLOC (ecma_type)
extern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_object (void)
{
#if JERRY_MEM_STATS
jmem_stats_allocate_object_bytes (sizeof (ecma_object_t));
#endif /* JERRY_MEM_STATS */
DECLARE_ROUTINES_FOR (object)
DECLARE_ROUTINES_FOR (number)
DECLARE_ROUTINES_FOR (collection_header)
DECLARE_ROUTINES_FOR (collection_chunk)
DECLARE_ROUTINES_FOR (string)
DECLARE_ROUTINES_FOR (getter_setter_pointers)
DECLARE_ROUTINES_FOR (external_pointer)
return (ecma_object_t *) jmem_pools_alloc (sizeof (ecma_object_t));
} /* ecma_alloc_object */
/**
* Dealloc memory from an ecma-object
*/
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
{
#if JERRY_MEM_STATS
jmem_stats_free_object_bytes (sizeof (ecma_object_t));
#endif /* JERRY_MEM_STATS */
jmem_pools_free (object_p, sizeof (ecma_object_t));
} /* ecma_dealloc_object */
/**
* Allocate memory for extended object
*
* @return pointer to allocated memory
*/
inline ecma_extended_object_t * __attr_always_inline___
ecma_alloc_extended_object (void)
extern inline ecma_extended_object_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_extended_object (size_t size) /**< size of object */
{
return jmem_heap_alloc_block (sizeof (ecma_extended_object_t));
#if JERRY_MEM_STATS
jmem_stats_allocate_object_bytes (size);
#endif /* JERRY_MEM_STATS */
return jmem_heap_alloc_block (size);
} /* ecma_alloc_extended_object */
/**
* Dealloc memory of an extended object
*/
inline void __attr_always_inline___
ecma_dealloc_extended_object (ecma_extended_object_t *ext_object_p) /**< property pair to be freed */
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
size_t size) /**< size of object */
{
jmem_heap_free_block (ext_object_p, sizeof (ecma_extended_object_t));
#if JERRY_MEM_STATS
jmem_stats_free_object_bytes (size);
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (object_p, size);
} /* ecma_dealloc_extended_object */
/**
* Allocate memory for ecma-string descriptor
*
* @return pointer to allocated memory
*/
extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string (void)
{
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (sizeof (ecma_string_t));
#endif /* JERRY_MEM_STATS */
return (ecma_string_t *) jmem_pools_alloc (sizeof (ecma_string_t));
} /* ecma_alloc_string */
/**
* Dealloc memory from ecma-string descriptor
*/
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
{
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (sizeof (ecma_string_t));
#endif /* JERRY_MEM_STATS */
jmem_pools_free (string_p, sizeof (ecma_string_t));
} /* ecma_dealloc_string */
/**
* Allocate memory for extended ecma-string descriptor
*
* @return pointer to allocated memory
*/
extern inline ecma_extended_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_extended_string (void)
{
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (sizeof (ecma_extended_string_t));
#endif /* JERRY_MEM_STATS */
return (ecma_extended_string_t *) jmem_heap_alloc_block (sizeof (ecma_extended_string_t));
} /* ecma_alloc_extended_string */
/**
* Dealloc memory from extended ecma-string descriptor
*/
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_extended_string (ecma_extended_string_t *ext_string_p) /**< extended string to be freed */
{
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (sizeof (ecma_extended_string_t));
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (ext_string_p, sizeof (ecma_extended_string_t));
} /* ecma_dealloc_extended_string */
/**
* Allocate memory for external ecma-string descriptor
*
* @return pointer to allocated memory
*/
extern inline ecma_external_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_external_string (void)
{
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (sizeof (ecma_external_string_t));
#endif /* JERRY_MEM_STATS */
return (ecma_external_string_t *) jmem_heap_alloc_block (sizeof (ecma_external_string_t));
} /* ecma_alloc_external_string */
/**
* Dealloc memory from external ecma-string descriptor
*/
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_external_string (ecma_external_string_t *ext_string_p) /**< external string to be freed */
{
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (sizeof (ecma_external_string_t));
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (ext_string_p, sizeof (ecma_external_string_t));
} /* ecma_dealloc_external_string */
/**
* Allocate memory for an string with character data
*
* @return pointer to allocated memory
*/
extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string_buffer (size_t size) /**< size of string */
{
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (size);
#endif /* JERRY_MEM_STATS */
return jmem_heap_alloc_block (size);
} /* ecma_alloc_string_buffer */
/**
* Dealloc memory of a string with character data
*/
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
size_t size) /**< size of string */
{
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (size);
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (string_p, size);
} /* ecma_dealloc_string_buffer */
/**
* Allocate memory for ecma-property pair
*
* @return pointer to allocated memory
*/
inline ecma_property_pair_t * __attr_always_inline___
extern inline ecma_property_pair_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_property_pair (void)
{
#if JERRY_MEM_STATS
jmem_stats_allocate_property_bytes (sizeof (ecma_property_pair_t));
#endif /* JERRY_MEM_STATS */
return jmem_heap_alloc_block (sizeof (ecma_property_pair_t));
} /* ecma_alloc_property_pair */
/**
* Dealloc memory of an ecma-property
*/
inline void __attr_always_inline___
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p) /**< property pair to be freed */
{
#if JERRY_MEM_STATS
jmem_stats_free_property_bytes (sizeof (ecma_property_pair_t));
#endif /* JERRY_MEM_STATS */
jmem_heap_free_block (property_pair_p, sizeof (ecma_property_pair_t));
} /* ecma_dealloc_property_pair */
+41 -53
View File
@@ -1,4 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,108 +30,96 @@
*
* @return pointer to allocated memory
*/
extern ecma_object_t *ecma_alloc_object (void);
ecma_object_t *ecma_alloc_object (void);
/**
* Dealloc memory from an ecma-object
*/
extern void ecma_dealloc_object (ecma_object_t *);
void ecma_dealloc_object (ecma_object_t *object_p);
/**
* Allocate memory for extended object
*
* @return pointer to allocated memory
*/
ecma_extended_object_t *ecma_alloc_extended_object (size_t size);
/**
* Dealloc memory of an extended object
*/
void ecma_dealloc_extended_object (ecma_object_t *object_p, size_t size);
/**
* Allocate memory for ecma-number
*
* @return pointer to allocated memory
*/
extern ecma_number_t *ecma_alloc_number (void);
ecma_number_t *ecma_alloc_number (void);
/**
* Dealloc memory from an ecma-number
*/
extern void ecma_dealloc_number (ecma_number_t *);
/**
* Allocate memory for header of a collection
*
* @return pointer to allocated memory
*/
extern ecma_collection_header_t *ecma_alloc_collection_header (void);
/**
* Dealloc memory from the collection's header
*/
extern void ecma_dealloc_collection_header (ecma_collection_header_t *);
/**
* Allocate memory for non-first chunk of a collection
*
* @return pointer to allocated memory
*/
extern ecma_collection_chunk_t *ecma_alloc_collection_chunk (void);
/**
* Dealloc memory from non-first chunk of a collection
*/
extern void ecma_dealloc_collection_chunk (ecma_collection_chunk_t *);
void ecma_dealloc_number (ecma_number_t *number_p);
/**
* Allocate memory for ecma-string descriptor
*
* @return pointer to allocated memory
*/
extern ecma_string_t *ecma_alloc_string (void);
ecma_string_t *ecma_alloc_string (void);
/**
* Dealloc memory from ecma-string descriptor
*/
extern void ecma_dealloc_string (ecma_string_t *);
void ecma_dealloc_string (ecma_string_t *string_p);
/**
* Allocate memory for getter-setter pointer pair
* Allocate memory for extended ecma-string descriptor
*
* @return pointer to allocated memory
*/
extern ecma_getter_setter_pointers_t *ecma_alloc_getter_setter_pointers (void);
ecma_extended_string_t *ecma_alloc_extended_string (void);
/**
* Dealloc memory from getter-setter pointer pair
* Dealloc memory from extended ecma-string descriptor
*/
extern void ecma_dealloc_getter_setter_pointers (ecma_getter_setter_pointers_t *);
void ecma_dealloc_extended_string (ecma_extended_string_t *string_p);
/**
* Allocate memory for external pointer
*
* @return pointer to allocated memory
*/
extern ecma_external_pointer_t *ecma_alloc_external_pointer (void);
/**
* Dealloc memory from external pointer
*/
extern void ecma_dealloc_external_pointer (ecma_external_pointer_t *);
/*
* Allocate memory for extended object
* Allocate memory for external ecma-string descriptor
*
* @return pointer to allocated memory
*/
extern ecma_extended_object_t *ecma_alloc_extended_object (void);
ecma_external_string_t *ecma_alloc_external_string (void);
/**
* Dealloc memory of an extended object
* Dealloc memory from external ecma-string descriptor
*/
extern void ecma_dealloc_extended_object (ecma_extended_object_t *);
void ecma_dealloc_external_string (ecma_external_string_t *string_p);
/**
* Allocate memory for string with character data
*
* @return pointer to allocated memory
*/
ecma_string_t *ecma_alloc_string_buffer (size_t size);
/**
* Dealloc memory of a string with character data
*/
void ecma_dealloc_string_buffer (ecma_string_t *string_p, size_t size);
/**
* Allocate memory for ecma-property pair
*
* @return pointer to allocated memory
*/
extern ecma_property_pair_t *ecma_alloc_property_pair (void);
ecma_property_pair_t *ecma_alloc_property_pair (void);
/**
* Dealloc memory from an ecma-property pair
*/
extern void ecma_dealloc_property_pair (ecma_property_pair_t *);
void ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p);
/**
* @}
@@ -0,0 +1,759 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* This file is automatically generated by the gen-strings.py script
* from ecma-error-messages.ini. Do not edit! */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_INVALID_GROUP, "Invalid group")
ECMA_ERROR_DEF (ECMA_ERR_INVALID_ESCAPE, "Invalid escape")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_ATOMICS || JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_INVALID_LENGTH, "Invalid length")
#endif /* JERRY_BUILTIN_ATOMICS \
|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_INVALID_OFFSET, "Invalid offset")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
ECMA_ERROR_DEF (ECMA_ERR_OBJECT_EXPECTED, "Object expected")
#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_INVALID_ARGUMENT, "Invalid argument")
#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_REGEXP */
ECMA_ERROR_DEF (ECMA_ERR_INVALID_ENCODING, "Invalid encoding")
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_NOTHING_TO_REPEAT, "Nothing to repeat")
#endif /* JERRY_BUILTIN_REGEXP */
ECMA_ERROR_DEF (ECMA_ERR_EXPECTED_AN_OBJECT, "Expected an object")
ECMA_ERROR_DEF (ECMA_ERR_INVALID_CAPABILITY, "Invalid capability")
#if JERRY_BUILTIN_STRING
ECMA_ERROR_DEF (ECMA_ERR_INVALID_CODE_POINT, "Invalid code point")
#endif /* JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_INVALID_QUANTIFIER, "Invalid quantifier")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_NO_SOURCE_ARGUMENT, "No source argument")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_UNTERMINATED_GROUP, "Unterminated group")
#endif /* JERRY_BUILTIN_REGEXP */
ECMA_ERROR_DEF (ECMA_ERR_EXPECTED_A_FUNCTION, "Expected a function")
#if JERRY_BUILTIN_JSON
ECMA_ERROR_DEF (ECMA_ERR_INVALID_JSON_FORMAT, "Invalid JSON format")
#endif /* JERRY_BUILTIN_JSON */
ECMA_ERROR_DEF (ECMA_ERR_INVALID_UTF8_STRING, "Invalid UTF8 string")
#if JERRY_BUILTIN_STRING
ECMA_ERROR_DEF (ECMA_ERR_INVALID_COUNT_VALUE, "Invalid count value")
#endif /* JERRY_BUILTIN_STRING */
#if !(JERRY_BUILTIN_REALMS)
ECMA_ERROR_DEF (ECMA_ERR_REALMS_ARE_DISABLED, "Realms are disabled")
#endif /* !(JERRY_BUILTIN_REALMS) */
ECMA_ERROR_DEF (ECMA_ERR_UNDEFINED_REFERENCE, "Undefined reference")
ECMA_ERROR_DEF (ECMA_ERR_INVALID_ARRAY_LENGTH, "Invalid Array length")
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_INVALID_REGEXP_FLAGS, "Invalid RegExp flags")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_JSON
ECMA_ERROR_DEF (ECMA_ERR_JSON_STRINGIFY_ERROR, "JSON stringify error")
#endif /* JERRY_BUILTIN_JSON */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_STACK_LIMIT_EXCEEDED, "Stack limit exceeded")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_WEAKREF
ECMA_ERROR_DEF (ECMA_ERR_TARGET_IS_NOT_OBJECT, "Target is not Object")
#endif /* JERRY_BUILTIN_WEAKREF */
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_BIGINT_VALUE_EXCPECTED, "BigInt value expected")
#endif /* JERRY_BUILTIN_BIGINT */
ECMA_ERROR_DEF (ECMA_ERR_BINDING_CANNOT_SET, "Binding cannot be set")
#if JERRY_BUILTIN_STRING
ECMA_ERROR_DEF (ECMA_ERR_INVALID_STRING_, "Invalid string length")
#endif /* JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_KEY_MUST_BE_AN_OBJECT, "Key must be an object")
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_ARRAY
ECMA_ERROR_DEF (ECMA_ERR_MISSING_ARRAY_ELEMENT, "Missing Array element")
#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_BUILTIN_WEAKREF
ECMA_ERROR_DEF (ECMA_ERR_TARGET_IS_NOT_WEAKREF, "Target is not weakRef")
#endif /* JERRY_BUILTIN_WEAKREF */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TARGET_NOT_EXTENSIBLE, "Target not extensible")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_ANNEXB
ECMA_ERROR_DEF (ECMA_ERR_GETTER_IS_NOT_CALLABLE, "Getter is not callable")
#endif /* JERRY_BUILTIN_ANNEXB */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_HANDLER_CANNOT_BE_NULL, "Handler cannot be null")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_INVALID_UTF8_CHARACTER, "Invalid UTF8 character")
ECMA_ERROR_DEF (ECMA_ERR_INVALID_UTF8_CODEPOINT, "Invalid UTF8 codepoint")
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_INVALID_CONTAINER_TYPE, "Invalid container type")
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_INVALID_RANGE_OF_INDEX, "Invalid range of index")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if !(JERRY_BUILTIN_PROXY)
ECMA_ERROR_DEF (ECMA_ERR_PROXY_IS_NOT_SUPPORTED, "Proxy is not supported")
#endif /* !(JERRY_BUILTIN_PROXY) */
#if !(JERRY_BUILTIN_REALMS)
ECMA_ERROR_DEF (ECMA_ERR_REALM_IS_NOT_AVAILABLE, "Realm is not available")
#endif /* !(JERRY_BUILTIN_REALMS) */
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_BIGINT_ZERO_DIVISION, "BigInt division by zero")
#endif /* JERRY_BUILTIN_BIGINT */
ECMA_ERROR_DEF (ECMA_ERR_EXPECTED_AN_ARRAYBUFFER, "Expected an ArrayBuffer")
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_INVALID_CHARACTER_CLASS, "Invalid character class")
ECMA_ERROR_DEF (ECMA_ERR_INVALID_ESCAPE_SEQUENCE, "Invalid escape sequence")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_SNAPSHOT_EXEC
ECMA_ERROR_DEF (ECMA_ERR_INVALID_SNAPSHOT_FORMAT, "Invalid snapshot format")
#endif /* JERRY_SNAPSHOT_EXEC */
#if JERRY_BUILTIN_JSON
ECMA_ERROR_DEF (ECMA_ERR_JSON_STRING_PARSE_ERROR, "JSON string parse error")
#endif /* JERRY_BUILTIN_JSON */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_LONE_QUANTIFIER_BRACKET, "Lone quantifier bracket")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_OBJECT_CANNOT_BE_FROZEN, "Object cannot be frozen")
ECMA_ERROR_DEF (ECMA_ERR_OBJECT_CANNOT_BE_SEALED, "Object cannot be sealed")
#endif /* JERRY_BUILTIN_PROXY */
#if !(JERRY_BUILTIN_REGEXP)
ECMA_ERROR_DEF (ECMA_ERR_REGEXP_IS_NOT_SUPPORTED, "RegExp is not supported")
#endif /* !(JERRY_BUILTIN_REGEXP) */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_UNMATCHED_CLOSE_BRACKET, "Unmatched close bracket")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_NOT_MODULE, "Argument is not a module")
#endif /* JERRY_MODULE_SYSTEM */
ECMA_ERROR_DEF (ECMA_ERR_SET_PROTOTYPE, "Cannot set [[Prototype]]")
#if JERRY_BUILTIN_ARRAY
ECMA_ERROR_DEF (ECMA_ERR_INVALID_NEW_ARRAY_LENGTH, "Invalid new Array length")
#endif /* JERRY_BUILTIN_ARRAY */
ECMA_ERROR_DEF (ECMA_ERR_ITERATOR_IS_NOT_CALLABLE, "Iterator is not callable")
#if !(JERRY_BUILTIN_JSON)
ECMA_ERROR_DEF (ECMA_ERR_JSON_NOT_SUPPORTED, "JSON support is disabled")
#endif /* !(JERRY_BUILTIN_JSON) */
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_MODULE_IS_IN_ERROR_STATE, "Module is in error state")
#endif /* JERRY_MODULE_SYSTEM */
ECMA_ERROR_DEF (ECMA_ERR_REJECT_MUST_BE_UNDEFINED, "Reject must be undefined")
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_REQUEST_IS_NOT_AVAILABLE, "Request is not available")
#endif /* JERRY_MODULE_SYSTEM */
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT, "Argument is not an object")
#if JERRY_BUILTIN_ATOMICS
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_NOT_SUPPORTED, "Argument is not supported")
#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_BUILTIN_STRING
ECMA_ERROR_DEF (ECMA_ERR_INVALID_CODE_POINT_ERROR, "Error: Invalid code point")
#endif /* JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_INVALID_TYPEDARRAY_LENGTH, "Invalid TypedArray length")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
ECMA_ERROR_DEF (ECMA_ERR_INVALID_HEXADECIMAL_VALUE, "Invalid hexadecimal value")
ECMA_ERROR_DEF (ECMA_ERR_ITERATOR_IS_NOT_AN_OBJECT, "Iterator is not an object")
ECMA_ERROR_DEF (ECMA_ERR_RESOLVE_MUST_BE_UNDEFINED, "Resolve must be undefined")
#if JERRY_SNAPSHOT_SAVE
ECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_BUFFER_SMALL, "Snapshot buffer too small")
#endif /* JERRY_SNAPSHOT_SAVE */
#if JERRY_BUILTIN_JSON
ECMA_ERROR_DEF (ECMA_ERR_THE_STRUCTURE_IS_CYCLICAL, "The structure is cyclical")
#endif /* JERRY_BUILTIN_JSON */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_UNEXPECTED_END_OF_PATTERN, "Unexpected end of pattern")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_SNAPSHOT_SAVE
ECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_UNSUPPORTED_COMPILED_CODE, "Unsupported compiled code")
#endif /* JERRY_SNAPSHOT_SAVE */
#if !(JERRY_BUILTIN_BIGINT)
ECMA_ERROR_DEF (ECMA_ERR_BIGINT_NOT_SUPPORTED, "BigInt support is disabled")
#endif /* !(JERRY_BUILTIN_BIGINT) */
#if JERRY_BUILTIN_DATAVIEW
ECMA_ERROR_DEF (ECMA_ERR_EXPECTED_A_DATAVIEW_OBJECT, "Expected a DataView object")
#endif /* JERRY_BUILTIN_DATAVIEW */
ECMA_ERROR_DEF (ECMA_ERR_EXPECTED_A_FUNCTION_OBJECT, "Expected a function object")
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_INVALID_ARRAYBUFFER_LENGTH, "Invalid ArrayBuffer length")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if !(JERRY_MODULE_SYSTEM)
ECMA_ERROR_DEF (ECMA_ERR_MODULE_NOT_SUPPORTED, "Module support is disabled")
#endif /* !(JERRY_MODULE_SYSTEM) */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_OBJECT_IS_NOT_A_TYPEDARRAY, "Object is not a TypedArray")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
ECMA_ERROR_DEF (ECMA_ERR_RECEIVER_MUST_BE_AN_OBJECT, "Receiver must be an object")
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_JSON
ECMA_ERROR_DEF (ECMA_ERR_BIGINT_SERIALIZED, "BigInt cannot be serialized")
#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_JSON */
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_CONTAINER_IS_NOT_AN_OBJECT, "Container is not an object.")
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_INVALID_HEX_ESCAPE_SEQUENCE, "Invalid hex escape sequence")
#endif /* JERRY_BUILTIN_REGEXP */
ECMA_ERROR_DEF (ECMA_ERR_INVALID_SPECIES_CONSTRUCTOR, "Invalid species constructor")
ECMA_ERROR_DEF (ECMA_ERR_PROXY_TRAP_RETURNED_FALSISH, "Proxy trap returned falsish")
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_MIN_GREATER_THAN_MAX, "Quantifier error: min > max")
#endif /* JERRY_BUILTIN_REGEXP */
ECMA_ERROR_DEF (ECMA_ERR_SYMBOL_IS_NOT_A_CONSTRUCTOR, "Symbol is not a constructor")
#if JERRY_BUILTIN_REFLECT
ECMA_ERROR_DEF (ECMA_ERR_TARGET_IS_NOT_A_CONSTRUCTOR, "Target is not a constructor")
#endif /* JERRY_BUILTIN_REFLECT */
ECMA_ERROR_DEF (ECMA_ERR_ACCESSOR_WRITABLE, "Accessors cannot be writable")
#if !(JERRY_BUILTIN_DATAVIEW)
ECMA_ERROR_DEF (ECMA_ERR_DATA_VIEW_NOT_SUPPORTED, "DataView support is disabled")
#endif /* !(JERRY_BUILTIN_DATAVIEW) */
#if JERRY_BUILTIN_DATE
ECMA_ERROR_DEF (ECMA_ERR_DATE_MUST_BE_A_FINITE_NUMBER, "Date must be a finite number")
#endif /* JERRY_BUILTIN_DATE */
ECMA_ERROR_DEF (ECMA_ERR_LOCAL_VARIABLE_IS_REDECLARED, "Local variable is redeclared")
ECMA_ERROR_DEF (ECMA_ERR_UNSUPPORTED_BINARY_OPERATION, "Unsupported binary operation")
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_UNTERMINATED_CHARACTER_CLASS, "Unterminated character class")
#endif /* JERRY_BUILTIN_REGEXP */
ECMA_ERROR_DEF (ECMA_ERR_ARRAYBUFFER_IS_DETACHED, "ArrayBuffer has been detached")
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_NOT_AN_OBJECT, "Constructor must be an object")
#if !(JERRY_BUILTIN_CONTAINER)
ECMA_ERROR_DEF (ECMA_ERR_CONTAINER_NOT_SUPPORTED, "Container support is disabled")
#endif /* !(JERRY_BUILTIN_CONTAINER) */
#if JERRY_BUILTIN_REALMS
ECMA_ERROR_DEF (ECMA_ERR_FIRST_ARGUMENT_IS_NOT_A_REALM, "First argument is not a realm")
#endif /* JERRY_BUILTIN_REALMS */
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_INCOMPATIBLE_TYPEDARRAY_TYPES, "Incompatible TypedArray types")
#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_INCORRECT_TYPE_FOR_TYPEDARRAY, "Incorrect type for TypedArray")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
ECMA_ERROR_DEF (ECMA_ERR_INVALID_OR_OUT_OF_RANGE_INDEX, "Invalid or out-of-range index")
#if JERRY_SNAPSHOT_SAVE
ECMA_ERROR_DEF (ECMA_ERR_MAXIMUM_SNAPSHOT_SIZE, "Maximum snapshot size reached")
#endif /* JERRY_SNAPSHOT_SAVE */
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_MODULE_CANNOT_BE_INSTANTIATED, "Module cannot be instantiated")
#endif /* JERRY_MODULE_SYSTEM */
ECMA_ERROR_DEF (ECMA_ERR_SPECIES_MUST_BE_A_CONSTRUCTOR, "Species must be a constructor")
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_IS_NOT_A_PROXY, "Argument is not a Proxy object")
#if JERRY_BUILTIN_ATOMICS || JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_NOT_ARRAY_BUFFER, "Argument is not an ArrayBuffer")
#endif /* JERRY_BUILTIN_ATOMICS \
|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_MAP_REQUIRES_NEW, "Constructor Map requires 'new'")
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_SET_REQUIRES_NEW, "Constructor Set requires 'new'")
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_MODULE_MUST_BE_IN_LINKED_STATE, "Module must be in linked state")
ECMA_ERROR_DEF (ECMA_ERR_UNKNOWN_EXPORT, "Native module export not found")
#endif /* JERRY_MODULE_SYSTEM */
ECMA_ERROR_DEF (ECMA_ERR_PASSED_ARGUMENT_IS_NOT_A_REALM, "Passed argument is not a realm")
ECMA_ERROR_DEF (ECMA_ERR_PRIVATE_METHOD_IS_NOT_WRITABLE, "Private method is not writable")
#if JERRY_BUILTIN_BIGINT || JERRY_BUILTIN_NUMBER
ECMA_ERROR_DEF (ECMA_ERR_RADIX_IS_OUT_OF_RANGE, "Radix must be between 2 and 36")
#endif /* JERRY_BUILTIN_BIGINT \
|| JERRY_BUILTIN_NUMBER */
#if !(JERRY_SNAPSHOT_EXEC)
ECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_EXEC_DISABLED, "Snapshot execution is disabled")
#endif /* !(JERRY_SNAPSHOT_EXEC) */
#if !(JERRY_BUILTIN_TYPEDARRAY)
ECMA_ERROR_DEF (ECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED, "TypedArray support is disabled")
#endif /* !(JERRY_BUILTIN_TYPEDARRAY) */
ECMA_ERROR_DEF (ECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING, "Unicode surrogate pair missing")
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_INVALID_CONTROL_ESCAPE_SEQUENCE, "Invalid control escape sequence")
ECMA_ERROR_DEF (ECMA_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE, "Invalid unicode escape sequence")
#endif /* JERRY_BUILTIN_REGEXP */
ECMA_ERROR_DEF (ECMA_ERR_ITERATOR_NEXT_IS_NOT_CALLABLE, "Iterator 'next' is not callable")
ECMA_ERROR_DEF (ECMA_ERR_ITERATOR_VALUE_IS_NOT_AN_OBJECT, "Iterator value is not an object")
ECMA_ERROR_DEF (ECMA_ERR_RESOLVE_METHOD_MUST_BE_CALLABLE, "Resolve method must be callable")
#if !(JERRY_SNAPSHOT_SAVE)
ECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_SAVE_DISABLED, "Snapshot generation is disabled")
#endif /* !(JERRY_SNAPSHOT_SAVE) */
#if !(JERRY_PARSER)
ECMA_ERROR_DEF (ECMA_ERR_PARSER_NOT_SUPPORTED, "Source code parsing is disabled")
#endif /* !(JERRY_PARSER) */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_MUST_RETURN_WITH_AN_OBJECT, "Trap must return with an object")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_UNSUPPORTED_CONTAINER_OPERATION, "Unsupported container operation")
#endif /* JERRY_BUILTIN_CONTAINER */
ECMA_ERROR_DEF (ECMA_ERR_METHOD_RETURN_IS_NOT_CALLABLE, "method 'return' is not callable")
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_PROMISE, "Argument 'this' is not a Promise")
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT, "Argument 'this' is not an object")
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_SYMBOL, "Argument 'this' must be a Symbol")
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_CALLBACK_RESULT_NOT_MODULE, "Callback result must be a module")
#endif /* JERRY_MODULE_SYSTEM */
ECMA_ERROR_DEF (ECMA_ERR_CLASS_CONSTRUCTOR_REQUIRES_NEW, "Class constructor requires 'new'")
#if JERRY_BUILTIN_ARRAY
ECMA_ERROR_DEF (ECMA_ERR_COMPARE_FUNC_NOT_CALLABLE, "Compare function is not callable")
#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_PROXY_REQUIRES_NEW, "Constructor Proxy requires 'new'")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_EXPECTED_A_CONFIGURABLE_PROPERTY, "Expected a configurable property")
ECMA_ERROR_DEF (ECMA_ERR_FIRST_PARAMETER_MUST_BE_CALLABLE, "First parameter must be callable")
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_FUNCTION_ADD_ORSET_IS_NOT_CALLABLE, "Function add/set is not callable")
#endif /* JERRY_BUILTIN_CONTAINER */
ECMA_ERROR_DEF (ECMA_ERR_ITERATOR_RESULT_IS_NOT_AN_OBJECT, "Iterator result is not an object")
#if (JERRY_STACK_LIMIT != 0)
ECMA_ERROR_DEF (ECMA_ERR_MAXIMUM_CALL_STACK_SIZE_EXCEEDED, "Maximum call stack size exceeded")
#endif /* (JERRY_STACK_LIMIT != 0) */
ECMA_ERROR_DEF (ECMA_ERR_MAXIMUM_STRING_LENGTH_IS_REACHED, "Maximum string length is reached")
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_MODULE_MUST_BE_IN_UNLINKED_STATE, "Module must be in unlinked state")
#endif /* JERRY_MODULE_SYSTEM */
#if JERRY_SNAPSHOT_EXEC
ECMA_ERROR_DEF (ECMA_ERR_STATIC_SNAPSHOTS_ARE_NOT_ENABLED, "Static snapshots are not enabled")
#endif /* JERRY_SNAPSHOT_EXEC */
#if JERRY_BUILTIN_WEAKREF
ECMA_ERROR_DEF (ECMA_ERR_WEAKREF_TARGET_MUST_BE_AN_OBJECT, "WeakRef target must be an object")
#endif /* JERRY_BUILTIN_WEAKREF */
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_FUNCTION, "Argument 'this' is not a function")
#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_CONTAINER || JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE, "Callback function is not callable")
#endif /* JERRY_BUILTIN_ARRAY \
|| JERRY_BUILTIN_CONTAINER \
|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_INITIAL_VALUE_CANNOT_BE_UNDEFINED, "Initial value cannot be undefined")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
ECMA_ERROR_DEF (ECMA_ERR_INVALID_SHARED_ARRAYBUFFER_LENGTH, "Invalid Shared ArrayBuffer length")
#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */
ECMA_ERROR_DEF (ECMA_ERR_INVALID_TYPE_FOR_CONSTRUCTOR_CALL, "Invalid type for constructor call")
ECMA_ERROR_DEF (ECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE, "Iterator 'throw' is not available")
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_NAMESPACE_OBJECT_IS_NOT_AVAILABLE, "Namespace object is not available")
#endif /* JERRY_MODULE_SYSTEM */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_PROXY_TARGET_IS_NOT_A_CONSTRUCTOR, "Proxy target is not a constructor")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_REALMS
ECMA_ERROR_DEF (ECMA_ERR_SECOND_ARGUMENT_MUST_BE_AN_OBJECT, "Second argument must be an object")
#endif /* JERRY_BUILTIN_REALMS */
#if JERRY_BUILTIN_DATAVIEW
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_BUFFER_NOT_OBJECT, "Argument 'buffer' is not an object")
#endif /* JERRY_BUILTIN_DATAVIEW */
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR, "Argument 'this' is not an iterator")
ECMA_ERROR_DEF (ECMA_ERR_VALUE_MSG, "Argument cannot be marked as error")
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_PROMISE_REQUIRES_NEW, "Constructor Promise requires 'new'")
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_WEAKMAP_REQUIRES_NEW, "Constructor WeakMap requires 'new'")
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_WEAKSET_REQUIRES_NEW, "Constructor WeakSet requires 'new'")
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_DEBUGGER
ECMA_ERROR_DEF (ECMA_ERR_INVALID_SCOPE_CHAIN_INDEX_FOR_EVAL, "Invalid scope chain index for eval")
#endif /* JERRY_DEBUGGER */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_MAXIMUM_TYPEDARRAY_SIZE_IS_REACHED, "Maximum TypedArray size is reached")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
ECMA_ERROR_DEF (ECMA_ERR_THE_GIVEN_ARGUMENT_IS_NOT_A_SYMBOL, "The given argument is not a Symbol")
ECMA_ERROR_DEF (ECMA_ERR_PARAMETER_REJECT_MUST_BE_CALLABLE, "'reject' parameter must be callable")
#if JERRY_BUILTIN_ATOMICS || JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_TYPED_ARRAY, "Argument 'this' is not a TypedArray")
#endif /* JERRY_BUILTIN_ATOMICS \
|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_SNAPSHOT_SAVE
ECMA_ERROR_DEF (ECMA_ERR_CANNOT_ALLOCATE_MEMORY_LITERALS, "Cannot allocate memory for literals")
#endif /* JERRY_SNAPSHOT_SAVE */
ECMA_ERROR_DEF (ECMA_ERR_INVOKE_NULLABLE_SUPER_METHOD, "Cannot invoke nullable super method")
#if JERRY_BUILTIN_DATAVIEW
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_DATAVIEW_REQUIRES_NEW, "Constructor DataView requires 'new'")
#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_WEAKREF
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_WEAKREF_REQUIRES_NEW, "Constructor WeakRef requires 'new'.")
#endif /* JERRY_BUILTIN_WEAKREF */
ECMA_ERROR_DEF (ECMA_ERR_SUPER_BINDING_MUST_BE_A_CONSTRUCTOR, "Super binding must be a constructor")
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_VALUE_CANNOT_BE_CONVERTED_TO_BIGINT, "Value cannot be converted to BigInt")
#endif /* JERRY_BUILTIN_BIGINT */
ECMA_ERROR_DEF (ECMA_ERR_PARAMETER_RESOLVE_MUST_BE_CALLABLE, "'resolve' parameter must be callable")
#if JERRY_BUILTIN_DATE
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_DATE_OBJECT, "Argument 'this' is not a Date object")
#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_CONSTRUCTOR, "Argument 'this' is not a constructor")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_BIGINT_FUNCTION_NOT_CONSTRUCTOR, "BigInt function is not a constructor")
#endif /* JERRY_BUILTIN_BIGINT */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTED_OBJECT_IS_NOT_TYPEDARRAY, "Constructed object is not TypedArray")
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_INT8_ARRAY_REQUIRES_NEW, "Constructor Int8Array requires 'new'")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_CONTAINER_IS_NOT_A_CONTAINER_OBJECT, "Container is not a container object.")
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_DATE
ECMA_ERROR_DEF (ECMA_ERR_INVALID_ARGUMENT_TYPE_IN_TOPRIMITIVE, "Invalid argument type in toPrimitive")
#endif /* JERRY_BUILTIN_DATE */
#if JERRY_ERROR_MESSAGES
ECMA_ERROR_DEF (ECMA_ERR_METHODS_INVOKE_WITH_NEW, "Methods cannot be invoked with 'new'")
#endif /* JERRY_ERROR_MESSAGES */
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_MODULE_EXPORTS_MUST_BE_STRING_VALUES, "Module exports must be string values")
#endif /* JERRY_MODULE_SYSTEM */
ECMA_ERROR_DEF (ECMA_ERR_PROTOTYPE_IS_NEITHER_OBJECT_NOR_NULL, "Prototype is neither object nor null")
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_THE_MAPFN_ARGUMENT_IS_NOT_CALLABLE, "The 'mapfn' argument is not callable")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_THE_TWO_DESCRIPTORS_ARE_INCOMPATIBLE, "The two descriptors are incompatible")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_WRONG_ARGS_MSG, "This type of argument is not allowed")
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_CONTAINER_NEEDED, "Value is not a Container or Iterator")
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP, "Argument 'this' is not a valid RegExp")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_ARRAY_BUFFER_DETACHED, "ArrayBuffer has already been detached")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
ECMA_ERROR_DEF (ECMA_ERR_BULTIN_ROUTINES_HAVE_NO_CONSTRUCTOR, "Built-in routines have no constructor")
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_INT16_ARRAY_REQUIRES_NEW, "Constructor Int16Array requires 'new'")
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_INT32_ARRAY_REQUIRES_NEW, "Constructor Int32Array requires 'new'")
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_UINT8_ARRAY_REQUIRES_NEW, "Constructor Uint8Array requires 'new'")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_SNAPSHOT_EXEC
ECMA_ERROR_DEF (ECMA_ERR_FUNCTION_INDEX_IS_HIGHER_THAN_MAXIMUM, "Function index is higher than maximum")
#endif /* JERRY_SNAPSHOT_EXEC */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_RANGE_OUT_OF_ORDER_IN_CHARACTER_CLASS, "Range out of order in character class")
#endif /* JERRY_BUILTIN_REGEXP */
ECMA_ERROR_DEF (ECMA_ERR_RESULT_OF_DEFAULTVALUE_IS_INVALID, "Result of [[DefaultValue]] is invalid")
ECMA_ERROR_DEF (ECMA_ERR_RIGHT_VALUE_OF_IN_MUST_BE_AN_OBJECT, "Right value of 'in' must be an object")
#if !(JERRY_BUILTIN_SHAREDARRAYBUFFER)
ECMA_ERROR_DEF (ECMA_ERR_SHARED_ARRAYBUFFER_NOT_SUPPORTED, "SharedArrayBuffer support is disabled")
#endif /* !(JERRY_BUILTIN_SHAREDARRAYBUFFER) */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_RETURNED_NEITHER_OBJECT_NOR_NULL, "Trap returned neither object nor null")
ECMA_ERROR_DEF (ECMA_ERR_TRAP_WITH_DUPLICATED_ENTRIES, "Trap returned with duplicated entries")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_UNARY_PLUS_IS_NOT_ALLOWED_FOR_BIGINTS, "Unary plus is not allowed for BigInts")
#endif /* JERRY_BUILTIN_BIGINT */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_IS_NOT_AN_REGEXP, "Argument 'this' is not a RegExp object")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_ALLOCATE_ARRAY_BUFFER, "Cannot allocate memory for ArrayBuffer")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
ECMA_ERROR_DEF (ECMA_ERR_CONSTANT_BINDINGS_CANNOT_BE_REASSIGNED, "Constant bindings cannot be reassigned")
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_ARRAYBUFFER_REQUIRES_NEW, "Constructor ArrayBuffer requires 'new'")
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_UINT16_ARRAY_REQUIRES_NEW, "Constructor Uint16Array requires 'new'")
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_UINT32_ARRAY_REQUIRES_NEW, "Constructor Uint32Array requires 'new'")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
ECMA_ERROR_DEF (ECMA_ERR_GENERATOR_IS_CURRENTLY_UNDER_EXECUTION, "Generator is currently under execution")
ECMA_ERROR_DEF (ECMA_ERR_ITERATOR_RETURN_RESULT_IS_NOT_OBJECT, "Iterator 'return' result is not object")
ECMA_ERROR_DEF (ECMA_ERR_SEARCH_STRING_CANNOT_BE_OF_TYPE_REGEXP, "Search string can't be of type: RegExp")
ECMA_ERROR_DEF (ECMA_ERR_VALUE_RECEIVED_BY_YIELD_IS_NOT_OBJECT, "Value received by yield* is not object")
#if JERRY_BUILTIN_BOOLEAN
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_BOOLEAN_OBJECT, "Argument 'this' is not a Boolean object")
#endif /* JERRY_BUILTIN_BOOLEAN */
ECMA_ERROR_DEF (ECMA_ERR_CANNOT_DECLARE_SAME_PRIVATE_FIELD_TWICE, "Cannot declare same private field twice")
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_FLOAT32_ARRAY_REQUIRES_NEW, "Constructor Float32Array requires 'new'")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_FLOAT64_ARRAY_REQUIRES_NEW, "Constructor Float64Array requires 'new'")
#endif /* JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64 */
ECMA_ERROR_DEF (ECMA_ERR_FUNCTION_PROTOTYPE_NOT_A_CONSTRUCTOR, "Function.prototype is not a constructor")
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_IMPORTED_BINDING_SHADOWS_LOCAL_VARIABLE, "Imported binding shadows local variable")
#endif /* JERRY_MODULE_SYSTEM */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_PROTOTYPE_FROM_REVOKED_PROXY_IS_INVALID, "Prototype from revoked Proxy is invalid")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING
ECMA_ERROR_DEF (ECMA_ERR_REGEXP_ARGUMENT_SHOULD_HAVE_GLOBAL_FLAG, "RegExp argument should have global flag")
#endif /* JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_IS_NEITHER_AN_OBJECT_NOR_UNDEFINED, "Trap is neither an object nor undefined")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_PROMISE_RESOLVE_ITSELF, "A promise cannot be resolved with itself")
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_BIGINT64_ARRAY_REQUIRES_NEW, "Constructor BigInt64Array requires 'new'")
#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_MODULE_EXPORTS_MUST_BE_VALID_IDENTIFIERS, "Module exports must be valid identifiers")
#endif /* JERRY_MODULE_SYSTEM */
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_GENERATOR_OBJECT, "Argument 'this' is not a generator object")
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_CANNOT_CONVERT_TO_OBJECT, "Argument cannot be converted to an object")
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_ALLOCATE_BIGINT_VALUE, "Cannot allocate memory for a BigInt value")
ECMA_ERROR_DEF (ECMA_ERR_CONVERT_BIGINT_TO_NUMBER, "Cannot convert a BigInt value to a number")
#endif /* JERRY_BUILTIN_BIGINT */
ECMA_ERROR_DEF (ECMA_ERR_CONVERT_SYMBOL_TO_NUMBER, "Cannot convert a Symbol value to a number")
ECMA_ERROR_DEF (ECMA_ERR_CONVERT_SYMBOL_TO_STRING, "Cannot convert a Symbol value to a string")
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_BIG_UINT64_ARRAY_REQUIRES_NEW, "Constructor BigUInt64Array requires 'new'")
#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_NUMBER
ECMA_ERROR_DEF (ECMA_ERR_FRACTION_DIGITS_OUT_OF_RANGE, "Fraction digits must be between 0 and 100")
#endif /* JERRY_BUILTIN_NUMBER */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_RETURN_VALUE_IS_NOT_AN_ARRAYBUFFER_OBJECT, "Return value is not an ArrayBuffer object")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
ECMA_ERROR_DEF (ECMA_ERR_SUPER_CONSTRUCTOR_MAY_ONLY_BE_CALLED_ONCE, "Super constructor may only be called once")
ECMA_ERROR_DEF (ECMA_ERR_BINDING_NOT_EXIST_OR_UNINITIALIZED, "Binding does not exist or is uninitialised")
#if JERRY_BUILTIN_ARRAY
ECMA_ERROR_DEF (ECMA_ERR_CANNOT_CONVERT_TO_OBJECT, "Cannot convert undefined or null to object")
#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_BUILTIN_NUMBER
ECMA_ERROR_DEF (ECMA_ERR_PRECISION_DIGITS_MUST_BE_BETWEEN_IN_RANGE, "Precision digits must be between 1 and 100")
#endif /* JERRY_BUILTIN_NUMBER */
ECMA_ERROR_DEF (ECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_GETTER, "Private field was defined without a getter")
ECMA_ERROR_DEF (ECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_SETTER, "Private field was defined without a setter")
ECMA_ERROR_DEF (ECMA_ERR_PROPERTY_NAME_IS_NEITHER_SYMBOL_NOR_STRING, "Property name is neither Symbol nor string")
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_STRING_CANNOT_BE_CONVERTED_TO_BIGINT_VALUE, "String cannot be converted to BigInt value")
#endif /* JERRY_BUILTIN_BIGINT */
#if JERRY_BUILTIN_CONTAINER
ECMA_ERROR_DEF (ECMA_ERR_INCORRECT_TYPE_CALL, "Operator called on incorrect container type")
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_ARRAY
ECMA_ERROR_DEF (ECMA_ERR_REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE, "Reduce of empty Array with no initial value")
#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP_OBJECT, "Argument 'this' is not a valid RegExp object")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_ARRAY_BUFFER_OBJECT, "Argument 'this' is not an ArrayBuffer object")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ERROR_MESSAGES
ECMA_ERROR_DEF (ECMA_ERR_ARROW_FUNCTIONS_INVOKE_WITH_NEW, "Arrow functions cannot be invoked with 'new'")
ECMA_ERROR_DEF (ECMA_ERR_ASYNC_FUNCTIONS_INVOKE_WITH_NEW, "Async functions cannot be invoked with 'new'")
#endif /* JERRY_ERROR_MESSAGES */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_SET_EXTENSIBLE_PROPERTY, "Cannot set [[Extensible]] property of object")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_SHAREDARRAYBUFFER_REQUIRES_NEW, "Constructor SharedArrayBuffer requires 'new'")
#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_CONSTRUCTOR_UINT8_CLAMPED_ARRAY_REQUIRES_NEW, "Constructor Uint8ClampedArray requires 'new'")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_NEGATIVE_EXPONENT_IS_NOT_ALLOWED_FOR_BIGINTS, "Negative exponent is not allowed for BigInts")
#endif /* JERRY_BUILTIN_BIGINT */
ECMA_ERROR_DEF (ECMA_ERR_PROMISE_ALL_REMAINING_ELEMENTS_LIMIT_REACHED, "Promise.all remaining elements limit reached")
ECMA_ERROR_DEF (ECMA_ERR_VALUE_RECEIVED_BY_FOR_ASYNC_OF_IS_NOT_OBJECT, "Value received by for-async-of is not object")
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_INFINITY_OR_NAN_CANNOT_BE_CONVERTED_TO_BIGINT, "Infinity or NaN cannot be converted to BigInt")
#endif /* JERRY_BUILTIN_BIGINT */
ECMA_ERROR_DEF (ECMA_ERR_OPERATOR_DELETE_RETURNED_FALSE_IN_STRICT_MODE, "Operator delete returned false in strict mode")
ECMA_ERROR_DEF (ECMA_ERR_PROPERTY_PROTOTYPE_IS_NOT_AN_OBJECT, "Property 'prototype' is not an object or null")
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_PROXY_HANDLER_IS_NULL_FOR_ISARRAY_OPERATION, "Proxy handler is null for 'isArray' operation")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_SNAPSHOT_SAVE
ECMA_ERROR_DEF (ECMA_ERR_REGULAR_EXPRESSION_NOT_SUPPORTED, "Regular expression literals are not supported")
#endif /* JERRY_SNAPSHOT_SAVE */
ECMA_ERROR_DEF (ECMA_ERR_RIGHT_VALUE_OF_INSTANCEOF_MUST_BE_AN_OBJECT, "Right value of 'instanceof' must be an object")
#if JERRY_SNAPSHOT_EXEC
ECMA_ERROR_DEF (ECMA_ERR_STATIC_SNAPSHOTS_CANNOT_BE_COPIED_INTO_MEMORY, "Static snapshots cannot be copied into memory")
#endif /* JERRY_SNAPSHOT_EXEC */
#if JERRY_SNAPSHOT_SAVE
ECMA_ERROR_DEF (ECMA_ERR_TAGGED_TEMPLATE_LITERALS, "Unsupported feature: tagged template literals")
ECMA_ERROR_DEF (ECMA_ERR_SNAPSHOT_FLAG_NOT_SUPPORTED, "Unsupported generate snapshot flags specified")
#endif /* JERRY_SNAPSHOT_SAVE */
#if JERRY_SNAPSHOT_EXEC
ECMA_ERROR_DEF (ECMA_ERR_UNSUPPORTED_SNAPSHOT_EXEC_FLAGS_ARE_SPECIFIED, "Unsupported snapshot exec flags are specified")
#endif /* JERRY_SNAPSHOT_EXEC */
ECMA_ERROR_DEF (ECMA_ERR_VALUE_FOR_CLASS_HERITAGE_IS_NOT_A_CONSTRUCTOR, "Value for class heritage is not a constructor")
ECMA_ERROR_DEF (ECMA_ERR_TOO_MANY_ARGUMENTS_DECLARED_FOR_FUNCTION_APPLY,
"Too many arguments declared for Function.apply")
#if JERRY_ERROR_MESSAGES
ECMA_ERROR_DEF (ECMA_ERR_ACCESSOR_FUNCTIONS_INVOKE_WITH_NEW, "Accessor functions cannot be invoked with 'new'")
#endif /* JERRY_ERROR_MESSAGES */
#if JERRY_MODULE_SYSTEM
ECMA_ERROR_DEF (ECMA_ERR_LINK_TO_MODULE_IN_ERROR_STATE, "Cannot link to a module which is in error state")
#endif /* JERRY_MODULE_SYSTEM */
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_ONLY_INTEGER_NUMBERS_CAN_BE_CONVERTED_TO_BIGINT,
"Only integer numbers can be converted to BigInt")
#endif /* JERRY_BUILTIN_BIGINT */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_TYPEDARRAY_INTRINSTIC_DIRECTLY_CALLED, "TypedArray intrinstic cannot be directly called")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_UNSIGNED_RIGHT_SHIFT_IS_NOT_ALLOWED_FOR_BIGINTS,
"Unsigned right shift is not allowed for BigInts")
#endif /* JERRY_BUILTIN_BIGINT */
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_ASYNC_GENERATOR, "Argument 'this' is not an async generator object")
ECMA_ERROR_DEF (ECMA_ERR_CLASS_EXTENDS_NOT_CONSTRUCTOR, "Class extends value is not a constructor or null")
#if JERRY_ERROR_MESSAGES
ECMA_ERROR_DEF (ECMA_ERR_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW, "Generator functions cannot be invoked with 'new'")
#endif /* JERRY_ERROR_MESSAGES */
#if JERRY_BUILTIN_REGEXP
ECMA_ERROR_DEF (ECMA_ERR_RETURN_VALUE_OF_EXEC_MUST_BE_AN_OBJECT_OR_NULL,
"Return value of 'exec' must be an object or null")
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_DATAVIEW
ECMA_ERROR_DEF (ECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER,
"Start offset is outside the bounds of the buffer")
#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER, "Argument 'this' is not a SharedArrayBuffer object")
#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */
ECMA_ERROR_DEF (ECMA_ERR_CLASS_CONSTRUCTOR_NEW, "Class constructor cannot be invoked without 'new'")
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_INCORRECT_RETURN_PROXY_GET_TRAP, "Incorrect value is returned by a Proxy 'get' trap")
ECMA_ERROR_DEF (ECMA_ERR_INCORRECT_RETURN_PROXY_SET_TRAP, "Incorrect value is returned by a Proxy 'set' trap")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_CLASS_IS_NON_CONFIGURABLE, "Prototype property of a class is non-configurable")
#if JERRY_BUILTIN_ARRAY
ECMA_ERROR_DEF (ECMA_ERR_PUSHING_TOO_HIGH_ELEMENT, "Pushing element over 2**53-1 length is disallowed")
#endif /* JERRY_BUILTIN_ARRAY */
ECMA_ERROR_DEF (ECMA_ERR_THE_REQUESTED_PROPERTY_UPDATE_CANNOT_BE_PERFORMED,
"The requested property update cannot be performed")
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_CONFIGURABLE_KEYS,
"Trap result did not include all configurable keys")
ECMA_ERROR_DEF (ECMA_ERR_TRAP_TRUISH_TARGET_NOT_EXTENSIBLE, "Trap returned truish for target is not extensible")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_NUMBER
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_NUMBER, "Argument 'this' is not a number or a Number object")
#endif /* JERRY_BUILTIN_NUMBER */
#if JERRY_BUILTIN_STRING
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_STRING_OBJECT, "Argument 'this' is not a string or a String object")
#endif /* JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER_OBJECT,
"Argument 'this' is not an SharedArrayBuffer object")
#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */
#if JERRY_ERROR_MESSAGES
ECMA_ERROR_DEF (ECMA_ERR_ASYNC_ARROW_FUNCTIONS_INVOKE_WITH_NEW, "Async arrow functions cannot be invoked with 'new'")
#endif /* JERRY_ERROR_MESSAGES */
#if JERRY_BUILTIN_ARRAY
ECMA_ERROR_DEF (ECMA_ERR_UNSHIFT_TOO_HIGH, "Unshift elements over 2**53-1 length is disallowed")
#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_NON_CONFIGURABLE_KEYS,
"Trap result did not include all non-configurable keys")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_ERROR_MESSAGES
ECMA_ERROR_DEF (ECMA_ERR_ASYNC_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW,
"Async generator functions cannot be invoked with 'new'")
#endif /* JERRY_ERROR_MESSAGES */
#if JERRY_BUILTIN_REFLECT
ECMA_ERROR_DEF (ECMA_ERR_REFLECT_EXPECTS_AN_OBJECT_AS_SECOND_ARGUMENT,
"Reflect.construct expects an object as second argument")
#endif /* JERRY_BUILTIN_REFLECT */
#if JERRY_ERROR_MESSAGES
ECMA_ERROR_DEF (ECMA_ERR_SCRIPT_GLOBAL_FUNCTIONS_INVOKE_WITH_NEW,
"Script (global) functions cannot be invoked with 'new'")
#endif /* JERRY_ERROR_MESSAGES */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_CANNOT_CREATE_PROXY, "Cannot create Proxy with a non-object target or handler")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_DERIVED_CTOR_RETURN_NOR_OBJECT_OR_UNDEFINED,
"Derived constructors may only return object or undefined")
#if JERRY_SNAPSHOT_EXEC
ECMA_ERROR_DEF (ECMA_ERR_INVALID_SNAPSHOT_VERSION_OR_FEATURES,
"Invalid snapshot version or unsupported features present")
#endif /* JERRY_SNAPSHOT_EXEC */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_TYPEDARRAY_SMALLER_THAN_FILTER_CALL_RESULT,
"Constructed TypedArray is smaller than filter call result")
ECMA_ERROR_DEF (ECMA_ERR_DERIVED_ARRAY_BUFFER_CTOR_BUFFER_TOO_SMALL,
"Derived ArrayBuffer constructor created a too small buffer")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_EXTENSIBILITY,
"Trap result does not reflect extensibility of Proxy target")
ECMA_ERROR_DEF (ECMA_ERR_TRAP_EXTRA_KEYS_FOR_A_NON_EXTENSIBLE_TARGET,
"Trap returned extra keys for a non-extensible Proxy target")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_ARRAY_BUFFER_RETURNED_THIS_FROM_CONSTRUCTOR,
"ArrayBuffer subclass returned this from species constructor")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_DATAVIEW
ECMA_ERROR_DEF (ECMA_ERR_ARGUMENT_BUFFER_NOT_ARRAY_OR_SHARED_BUFFER,
"Argument 'buffer' is not an ArrayBuffer or SharedArrayBuffer")
#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_INEXTENSIBILITY,
"Trap result does not reflect inextensibility of Proxy target")
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_TYPEDARRAY_INTRINSTIC_CALLED_BY_NEW_EXPRESSION,
"TypedArray intrinstic cannot be called by a 'new' expression")
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY
ECMA_ERROR_DEF (ECMA_ERR_CONTENTTYPE_RETURNED_TYPEDARRAY_NOT_MATCH_SOURCE,
"TypedArray returned by [[ContentType]] does not match source")
#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_BIGINT
ECMA_ERROR_DEF (ECMA_ERR_ALLOCATE_BIGINT_STRING, "Cannot allocate memory for a string representation of a BigInt value")
#endif /* JERRY_BUILTIN_BIGINT */
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TARGET_NOT_EXTENSIBLE_DIFFERENT_PROTOTYPE_RETURNED,
"Target object is non-extensible and trap returned different prototype")
ECMA_ERROR_DEF (ECMA_ERR_TRAP_TRUISH_ADDING_PROPERTY_NON_EXTENSIBLE_TARGET,
"Trap returned truish for adding property to the non-extensible target")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_CANNOT_READ_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT,
"Cannot read private member to an object whose class did not declare it")
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_GIVEN_PROPERTY_IS_A_NON_CONFIGURABLE,
"Given property is a non-configurable data property on the proxy target")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_CANNOT_WRITE_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT,
"Cannot write private member to an object whose class did not declare it")
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_FALSISH_PROPERTY_TARGET_NOT_EXTENSIBLE,
"Trap returned falsish for property but the proxy target is not extensible")
ECMA_ERROR_DEF (ECMA_ERR_PROXY_PROPERTY_NOT_CONFIGURABLE_NOT_HAVE_GETTER,
"Property of a Proxy is non-configurable and does not have a getter function")
ECMA_ERROR_DEF (ECMA_ERR_TARGET_PROPERTY_CONFIGURE_ACCESSOR_WITHOUT_SETTER,
"The property of a Proxy target is a non configurable accessor without a setter")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_LET_CONST_NOT_INITIALIZED,
"Variables declared by let/const must be initialized before reading their value")
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_TRUISH_PROPERTY_NON_CONFIGURABLE,
"Trap returned truish for property which is non-configurable in the proxy target")
ECMA_ERROR_DEF (ECMA_ERR_TARGET_NOT_EXTENSIBLE_NOT_RETURNED_ITS_PROTOTYPE,
"Proxy target is non-extensible, but the trap did not return its actual prototype")
ECMA_ERROR_DEF (ECMA_ERR_TRAP_FALSISH_PROPERTY_NON_CONFIGURABLE,
"Trap returned falsish for property which exists in the proxy target as non-configurable")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_CALL_SUPER_CONSTRUCTOR_DERIVED_CLASS_BEFORE_THIS,
"Must call super constructor in derived class before accessing 'this' or returning from it")
#if JERRY_BUILTIN_PROXY
ECMA_ERROR_DEF (ECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY,
"Trap returned truish for defining non-configurable property which is non-existent in the target")
ECMA_ERROR_DEF (
ECMA_ERR_TRAP_TRUISH_ADD_PROPERTY_INCOMPATIBLE_OTHER_PROP,
"Trap returned truish for adding property that is incompatible with the existing property in the target")
#endif /* JERRY_BUILTIN_PROXY */
ECMA_ERROR_DEF (ECMA_ERR_CANNOT_ACCESS_CALLER_CALLE_ARGUMENTS,
"'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the "
"arguments objects for calls to them")
@@ -0,0 +1,330 @@
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
[ECMA_ERROR_MESSAGES]
ECMA_ERR_CANNOT_ACCESS_CALLER_CALLE_ARGUMENTS = "'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them"
ECMA_ERR_PARAMETER_REJECT_MUST_BE_CALLABLE = "'reject' parameter must be callable"
ECMA_ERR_PARAMETER_RESOLVE_MUST_BE_CALLABLE = "'resolve' parameter must be callable"
ECMA_ERR_PROMISE_RESOLVE_ITSELF = "A promise cannot be resolved with itself"
ECMA_ERR_ACCESSOR_WRITABLE = "Accessors cannot be writable"
ECMA_ERR_ARGUMENT_BUFFER_NOT_ARRAY_OR_SHARED_BUFFER = "Argument 'buffer' is not an ArrayBuffer or SharedArrayBuffer"
ECMA_ERR_ARGUMENT_BUFFER_NOT_OBJECT = "Argument 'buffer' is not an object"
ECMA_ERR_ARGUMENT_THIS_NOT_ARRAY_BUFFER_OBJECT = "Argument 'this' is not an ArrayBuffer object"
ECMA_ERR_ARGUMENT_THIS_NOT_BOOLEAN_OBJECT = "Argument 'this' is not a Boolean object"
ECMA_ERR_ARGUMENT_THIS_NOT_DATE_OBJECT = "Argument 'this' is not a Date object"
ECMA_ERR_ARGUMENT_THIS_NOT_PROMISE = "Argument 'this' is not a Promise"
ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER = "Argument 'this' is not a SharedArrayBuffer object"
ECMA_ERR_ARGUMENT_THIS_NOT_TYPED_ARRAY = "Argument 'this' is not a TypedArray"
ECMA_ERR_ARGUMENT_THIS_NOT_CONSTRUCTOR = "Argument 'this' is not a constructor"
ECMA_ERR_ARGUMENT_THIS_NOT_FUNCTION = "Argument 'this' is not a function"
ECMA_ERR_ARGUMENT_THIS_NOT_GENERATOR_OBJECT = "Argument 'this' is not a generator object"
ECMA_ERR_ARGUMENT_THIS_NOT_NUMBER = "Argument 'this' is not a number or a Number object"
ECMA_ERR_ARGUMENT_THIS_NOT_STRING_OBJECT = "Argument 'this' is not a string or a String object"
ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP = "Argument 'this' is not a valid RegExp"
ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP_OBJECT = "Argument 'this' is not a valid RegExp object"
ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER_OBJECT = "Argument 'this' is not an SharedArrayBuffer object"
ECMA_ERR_ARGUMENT_THIS_NOT_ASYNC_GENERATOR = "Argument 'this' is not an async generator object"
ECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR = "Argument 'this' is not an iterator"
ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT = "Argument 'this' is not an object"
ECMA_ERR_ARGUMENT_THIS_NOT_SYMBOL = "Argument 'this' must be a Symbol"
ECMA_ERR_ARGUMENT_CANNOT_CONVERT_TO_OBJECT = "Argument cannot be converted to an object"
ECMA_ERR_ARGUMENT_NOT_ARRAY_BUFFER = "Argument is not an ArrayBuffer"
ECMA_ERR_ARGUMENT_NOT_SUPPORTED = "Argument is not supported"
ECMA_ERR_ARRAY_BUFFER_DETACHED = "ArrayBuffer has already been detached"
ECMA_ERR_ARRAY_BUFFER_RETURNED_THIS_FROM_CONSTRUCTOR = "ArrayBuffer subclass returned this from species constructor"
ECMA_ERR_BIGINT_SERIALIZED = "BigInt cannot be serialized"
ECMA_ERR_BIGINT_ZERO_DIVISION = "BigInt division by zero"
ECMA_ERR_BIGINT_FUNCTION_NOT_CONSTRUCTOR = "BigInt function is not a constructor"
ECMA_ERR_BIGINT_VALUE_EXCPECTED = "BigInt value expected"
ECMA_ERR_BINDING_CANNOT_SET = "Binding cannot be set"
ECMA_ERR_BINDING_NOT_EXIST_OR_UNINITIALIZED = "Binding does not exist or is uninitialised"
ECMA_ERR_BULTIN_ROUTINES_HAVE_NO_CONSTRUCTOR = "Built-in routines have no constructor"
ECMA_ERR_CALLBACK_RESULT_NOT_MODULE = "Callback result must be a module"
ECMA_ERR_ALLOCATE_ARRAY_BUFFER = "Cannot allocate memory for ArrayBuffer"
ECMA_ERR_ALLOCATE_BIGINT_VALUE = "Cannot allocate memory for a BigInt value"
ECMA_ERR_ALLOCATE_BIGINT_STRING = "Cannot allocate memory for a string representation of a BigInt value"
ECMA_ERR_CONVERT_BIGINT_TO_NUMBER = "Cannot convert a BigInt value to a number"
ECMA_ERR_CONVERT_SYMBOL_TO_NUMBER = "Cannot convert a Symbol value to a number"
ECMA_ERR_CONVERT_SYMBOL_TO_STRING = "Cannot convert a Symbol value to a string"
ECMA_ERR_CANNOT_CREATE_PROXY = "Cannot create Proxy with a non-object target or handler"
ECMA_ERR_INVOKE_NULLABLE_SUPER_METHOD = "Cannot invoke nullable super method"
ECMA_ERR_LINK_TO_MODULE_IN_ERROR_STATE = "Cannot link to a module which is in error state"
ECMA_ERR_SET_EXTENSIBLE_PROPERTY = "Cannot set [[Extensible]] property of object"
ECMA_ERR_SET_PROTOTYPE = "Cannot set [[Prototype]]"
ECMA_ERR_CLASS_CONSTRUCTOR_REQUIRES_NEW = "Class constructor requires 'new'"
ECMA_ERR_CLASS_EXTENDS_NOT_CONSTRUCTOR = "Class extends value is not a constructor or null"
ECMA_ERR_COMPARE_FUNC_NOT_CALLABLE = "Compare function is not callable"
ECMA_ERR_CONSTANT_BINDINGS_CANNOT_BE_REASSIGNED = "Constant bindings cannot be reassigned"
ECMA_ERR_TYPEDARRAY_SMALLER_THAN_FILTER_CALL_RESULT = "Constructed TypedArray is smaller than filter call result"
ECMA_ERR_CONSTRUCTED_OBJECT_IS_NOT_TYPEDARRAY = "Constructed object is not TypedArray"
ECMA_ERR_CONSTRUCTOR_ARRAYBUFFER_REQUIRES_NEW = "Constructor ArrayBuffer requires 'new'"
ECMA_ERR_CONSTRUCTOR_BIGINT64_ARRAY_REQUIRES_NEW = "Constructor BigInt64Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_BIG_UINT64_ARRAY_REQUIRES_NEW = "Constructor BigUInt64Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_DATAVIEW_REQUIRES_NEW = "Constructor DataView requires 'new'"
ECMA_ERR_CONSTRUCTOR_FLOAT32_ARRAY_REQUIRES_NEW = "Constructor Float32Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_FLOAT64_ARRAY_REQUIRES_NEW = "Constructor Float64Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_INT16_ARRAY_REQUIRES_NEW = "Constructor Int16Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_INT32_ARRAY_REQUIRES_NEW = "Constructor Int32Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_INT8_ARRAY_REQUIRES_NEW = "Constructor Int8Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_MAP_REQUIRES_NEW = "Constructor Map requires 'new'"
ECMA_ERR_CONSTRUCTOR_PROMISE_REQUIRES_NEW = "Constructor Promise requires 'new'"
ECMA_ERR_CONSTRUCTOR_PROXY_REQUIRES_NEW = "Constructor Proxy requires 'new'"
ECMA_ERR_CONSTRUCTOR_SET_REQUIRES_NEW = "Constructor Set requires 'new'"
ECMA_ERR_CONSTRUCTOR_SHAREDARRAYBUFFER_REQUIRES_NEW = "Constructor SharedArrayBuffer requires 'new'"
ECMA_ERR_CONSTRUCTOR_UINT16_ARRAY_REQUIRES_NEW = "Constructor Uint16Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_UINT32_ARRAY_REQUIRES_NEW = "Constructor Uint32Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_UINT8_ARRAY_REQUIRES_NEW = "Constructor Uint8Array requires 'new'"
ECMA_ERR_CONSTRUCTOR_UINT8_CLAMPED_ARRAY_REQUIRES_NEW = "Constructor Uint8ClampedArray requires 'new'"
ECMA_ERR_CONSTRUCTOR_WEAKMAP_REQUIRES_NEW = "Constructor WeakMap requires 'new'"
ECMA_ERR_CONSTRUCTOR_WEAKREF_REQUIRES_NEW = "Constructor WeakRef requires 'new'."
ECMA_ERR_CONSTRUCTOR_WEAKSET_REQUIRES_NEW = "Constructor WeakSet requires 'new'"
ECMA_ERR_CONSTRUCTOR_NOT_AN_OBJECT = "Constructor must be an object"
ECMA_ERR_CONTAINER_IS_NOT_A_CONTAINER_OBJECT = "Container is not a container object."
ECMA_ERR_CONTAINER_IS_NOT_AN_OBJECT = "Container is not an object."
ECMA_ERR_DATE_MUST_BE_A_FINITE_NUMBER = "Date must be a finite number"
ECMA_ERR_DERIVED_ARRAY_BUFFER_CTOR_BUFFER_TOO_SMALL = "Derived ArrayBuffer constructor created a too small buffer"
ECMA_ERR_DERIVED_CTOR_RETURN_NOR_OBJECT_OR_UNDEFINED = "Derived constructors may only return object or undefined"
ECMA_ERR_INVALID_CODE_POINT_ERROR = "Error: Invalid code point"
ECMA_ERR_EXPECTED_A_DATAVIEW_OBJECT = "Expected a DataView object"
ECMA_ERR_EXPECTED_A_CONFIGURABLE_PROPERTY = "Expected a configurable property"
ECMA_ERR_EXPECTED_A_FUNCTION_OBJECT = "Expected a function object"
ECMA_ERR_EXPECTED_AN_ARRAYBUFFER = "Expected an ArrayBuffer"
ECMA_ERR_EXPECTED_AN_OBJECT = "Expected an object"
ECMA_ERR_FIRST_ARGUMENT_IS_NOT_A_REALM = "First argument is not a realm"
ECMA_ERR_FIRST_PARAMETER_MUST_BE_CALLABLE = "First parameter must be callable"
ECMA_ERR_FRACTION_DIGITS_OUT_OF_RANGE = "Fraction digits must be between 0 and 100"
ECMA_ERR_FUNCTION_ADD_ORSET_IS_NOT_CALLABLE = "Function add/set is not callable"
ECMA_ERR_FUNCTION_INDEX_IS_HIGHER_THAN_MAXIMUM = "Function index is higher than maximum"
ECMA_ERR_FUNCTION_PROTOTYPE_NOT_A_CONSTRUCTOR = "Function.prototype is not a constructor"
ECMA_ERR_GENERATOR_IS_CURRENTLY_UNDER_EXECUTION = "Generator is currently under execution"
ECMA_ERR_GETTER_IS_NOT_CALLABLE = "Getter is not callable"
ECMA_ERR_GIVEN_PROPERTY_IS_A_NON_CONFIGURABLE = "Given property is a non-configurable data property on the proxy target"
ECMA_ERR_HANDLER_CANNOT_BE_NULL = "Handler cannot be null"
ECMA_ERR_IMPORTED_BINDING_SHADOWS_LOCAL_VARIABLE = "Imported binding shadows local variable"
ECMA_ERR_INCOMPATIBLE_TYPEDARRAY_TYPES = "Incompatible TypedArray types"
ECMA_ERR_INCORRECT_TYPE_FOR_TYPEDARRAY = "Incorrect type for TypedArray"
ECMA_ERR_INCORRECT_RETURN_PROXY_GET_TRAP = "Incorrect value is returned by a Proxy 'get' trap"
ECMA_ERR_INCORRECT_RETURN_PROXY_SET_TRAP = "Incorrect value is returned by a Proxy 'set' trap"
ECMA_ERR_INFINITY_OR_NAN_CANNOT_BE_CONVERTED_TO_BIGINT = "Infinity or NaN cannot be converted to BigInt"
ECMA_ERR_INITIAL_VALUE_CANNOT_BE_UNDEFINED = "Initial value cannot be undefined"
ECMA_ERR_INVALID_ARRAYBUFFER_LENGTH = "Invalid ArrayBuffer length"
ECMA_ERR_INVALID_JSON_FORMAT = "Invalid JSON format"
ECMA_ERR_INVALID_REGEXP_FLAGS = "Invalid RegExp flags"
ECMA_ERR_INVALID_SHARED_ARRAYBUFFER_LENGTH = "Invalid Shared ArrayBuffer length"
ECMA_ERR_INVALID_TYPEDARRAY_LENGTH = "Invalid TypedArray length"
ECMA_ERR_INVALID_UTF8_CHARACTER = "Invalid UTF8 character"
ECMA_ERR_INVALID_UTF8_CODEPOINT = "Invalid UTF8 codepoint"
ECMA_ERR_INVALID_UTF8_STRING = "Invalid UTF8 string"
ECMA_ERR_INVALID_ENCODING = "Invalid encoding"
ECMA_ERR_INVALID_ARGUMENT = "Invalid argument"
ECMA_ERR_INVALID_ARGUMENT_TYPE_IN_TOPRIMITIVE = "Invalid argument type in toPrimitive"
ECMA_ERR_INVALID_CAPABILITY = "Invalid capability"
ECMA_ERR_INVALID_CHARACTER_CLASS = "Invalid character class"
ECMA_ERR_INVALID_CODE_POINT = "Invalid code point"
ECMA_ERR_INVALID_CONTAINER_TYPE = "Invalid container type"
ECMA_ERR_INVALID_CONTROL_ESCAPE_SEQUENCE = "Invalid control escape sequence"
ECMA_ERR_INVALID_COUNT_VALUE = "Invalid count value"
ECMA_ERR_INVALID_ESCAPE = "Invalid escape"
ECMA_ERR_INVALID_ESCAPE_SEQUENCE = "Invalid escape sequence"
ECMA_ERR_INVALID_GROUP = "Invalid group"
ECMA_ERR_INVALID_HEX_ESCAPE_SEQUENCE = "Invalid hex escape sequence"
ECMA_ERR_INVALID_HEXADECIMAL_VALUE = "Invalid hexadecimal value"
ECMA_ERR_INVALID_LENGTH = "Invalid length"
ECMA_ERR_INVALID_NEW_ARRAY_LENGTH = "Invalid new Array length"
ECMA_ERR_INVALID_OFFSET = "Invalid offset"
ECMA_ERR_INVALID_OR_OUT_OF_RANGE_INDEX = "Invalid or out-of-range index"
ECMA_ERR_INVALID_QUANTIFIER = "Invalid quantifier"
ECMA_ERR_INVALID_RANGE_OF_INDEX = "Invalid range of index"
ECMA_ERR_INVALID_SCOPE_CHAIN_INDEX_FOR_EVAL = "Invalid scope chain index for eval"
ECMA_ERR_INVALID_SPECIES_CONSTRUCTOR = "Invalid species constructor"
ECMA_ERR_INVALID_STRING_ = "Invalid string length"
ECMA_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE = "Invalid unicode escape sequence"
ECMA_ERR_ITERATOR_NEXT_IS_NOT_CALLABLE = "Iterator 'next' is not callable"
ECMA_ERR_ITERATOR_RETURN_RESULT_IS_NOT_OBJECT = "Iterator 'return' result is not object"
ECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE = "Iterator 'throw' is not available"
ECMA_ERR_ITERATOR_IS_NOT_AN_OBJECT = "Iterator is not an object"
ECMA_ERR_ITERATOR_IS_NOT_CALLABLE = "Iterator is not callable"
ECMA_ERR_ITERATOR_RESULT_IS_NOT_AN_OBJECT = "Iterator result is not an object"
ECMA_ERR_ITERATOR_VALUE_IS_NOT_AN_OBJECT = "Iterator value is not an object"
ECMA_ERR_JSON_STRING_PARSE_ERROR = "JSON string parse error"
ECMA_ERR_JSON_STRINGIFY_ERROR = "JSON stringify error"
ECMA_ERR_KEY_MUST_BE_AN_OBJECT = "Key must be an object"
ECMA_ERR_LONE_QUANTIFIER_BRACKET = "Lone quantifier bracket"
ECMA_ERR_MAXIMUM_TYPEDARRAY_SIZE_IS_REACHED = "Maximum TypedArray size is reached"
ECMA_ERR_MAXIMUM_STRING_LENGTH_IS_REACHED = "Maximum string length is reached"
ECMA_ERR_MISSING_ARRAY_ELEMENT = "Missing Array element"
ECMA_ERR_MODULE_CANNOT_BE_INSTANTIATED = "Module cannot be instantiated"
ECMA_ERR_MODULE_EXPORTS_MUST_BE_STRING_VALUES = "Module exports must be string values"
ECMA_ERR_MODULE_EXPORTS_MUST_BE_VALID_IDENTIFIERS = "Module exports must be valid identifiers"
ECMA_ERR_MODULE_IS_IN_ERROR_STATE = "Module is in error state"
ECMA_ERR_MODULE_MUST_BE_IN_LINKED_STATE = "Module must be in linked state"
ECMA_ERR_MODULE_MUST_BE_IN_UNLINKED_STATE = "Module must be in unlinked state"
ECMA_ERR_CALL_SUPER_CONSTRUCTOR_DERIVED_CLASS_BEFORE_THIS = "Must call super constructor in derived class before accessing 'this' or returning from it"
ECMA_ERR_NAMESPACE_OBJECT_IS_NOT_AVAILABLE = "Namespace object is not available"
ECMA_ERR_NEGATIVE_EXPONENT_IS_NOT_ALLOWED_FOR_BIGINTS = "Negative exponent is not allowed for BigInts"
ECMA_ERR_NO_SOURCE_ARGUMENT = "No source argument"
ECMA_ERR_NOTHING_TO_REPEAT = "Nothing to repeat"
ECMA_ERR_OBJECT_CANNOT_BE_FROZEN = "Object cannot be frozen"
ECMA_ERR_OBJECT_CANNOT_BE_SEALED = "Object cannot be sealed"
ECMA_ERR_OBJECT_EXPECTED = "Object expected"
ECMA_ERR_OBJECT_IS_NOT_A_TYPEDARRAY = "Object is not a TypedArray"
ECMA_ERR_ONLY_INTEGER_NUMBERS_CAN_BE_CONVERTED_TO_BIGINT = "Only integer numbers can be converted to BigInt"
ECMA_ERR_OPERATOR_DELETE_RETURNED_FALSE_IN_STRICT_MODE = "Operator delete returned false in strict mode"
ECMA_ERR_PASSED_ARGUMENT_IS_NOT_A_REALM = "Passed argument is not a realm"
ECMA_ERR_PRECISION_DIGITS_MUST_BE_BETWEEN_IN_RANGE = "Precision digits must be between 1 and 100"
ECMA_ERR_PROMISE_ALL_REMAINING_ELEMENTS_LIMIT_REACHED = "Promise.all remaining elements limit reached"
ECMA_ERR_PROPERTY_PROTOTYPE_IS_NOT_AN_OBJECT = "Property 'prototype' is not an object or null"
ECMA_ERR_PROPERTY_NAME_IS_NEITHER_SYMBOL_NOR_STRING = "Property name is neither Symbol nor string"
ECMA_ERR_PROXY_PROPERTY_NOT_CONFIGURABLE_NOT_HAVE_GETTER = "Property of a Proxy is non-configurable and does not have a getter function"
ECMA_ERR_PROTOTYPE_FROM_REVOKED_PROXY_IS_INVALID = "Prototype from revoked Proxy is invalid"
ECMA_ERR_PROTOTYPE_IS_NEITHER_OBJECT_NOR_NULL = "Prototype is neither object nor null"
ECMA_ERR_PROXY_HANDLER_IS_NULL_FOR_ISARRAY_OPERATION = "Proxy handler is null for 'isArray' operation"
ECMA_ERR_PROXY_IS_NOT_SUPPORTED = "Proxy is not supported"
ECMA_ERR_TARGET_NOT_EXTENSIBLE_NOT_RETURNED_ITS_PROTOTYPE = "Proxy target is non-extensible, but the trap did not return its actual prototype"
ECMA_ERR_PROXY_TRAP_RETURNED_FALSISH = "Proxy trap returned falsish"
ECMA_ERR_PUSHING_TOO_HIGH_ELEMENT = "Pushing element over 2**53-1 length is disallowed"
ECMA_ERR_MIN_GREATER_THAN_MAX = "Quantifier error: min > max"
ECMA_ERR_RADIX_IS_OUT_OF_RANGE = "Radix must be between 2 and 36"
ECMA_ERR_RANGE_OUT_OF_ORDER_IN_CHARACTER_CLASS = "Range out of order in character class"
ECMA_ERR_REALM_IS_NOT_AVAILABLE = "Realm is not available"
ECMA_ERR_REALMS_ARE_DISABLED = "Realms are disabled"
ECMA_ERR_REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE = "Reduce of empty Array with no initial value"
ECMA_ERR_REFLECT_EXPECTS_AN_OBJECT_AS_SECOND_ARGUMENT = "Reflect.construct expects an object as second argument"
ECMA_ERR_REGEXP_ARGUMENT_SHOULD_HAVE_GLOBAL_FLAG = "RegExp argument should have global flag"
ECMA_ERR_REGEXP_IS_NOT_SUPPORTED = "RegExp is not supported"
ECMA_ERR_REJECT_MUST_BE_UNDEFINED = "Reject must be undefined"
ECMA_ERR_REQUEST_IS_NOT_AVAILABLE = "Request is not available"
ECMA_ERR_RESOLVE_METHOD_MUST_BE_CALLABLE = "Resolve method must be callable"
ECMA_ERR_RESOLVE_MUST_BE_UNDEFINED = "Resolve must be undefined"
ECMA_ERR_RESULT_OF_DEFAULTVALUE_IS_INVALID = "Result of [[DefaultValue]] is invalid"
ECMA_ERR_RETURN_VALUE_IS_NOT_AN_ARRAYBUFFER_OBJECT = "Return value is not an ArrayBuffer object"
ECMA_ERR_RETURN_VALUE_OF_EXEC_MUST_BE_AN_OBJECT_OR_NULL = "Return value of 'exec' must be an object or null"
ECMA_ERR_RIGHT_VALUE_OF_IN_MUST_BE_AN_OBJECT = "Right value of 'in' must be an object"
ECMA_ERR_RIGHT_VALUE_OF_INSTANCEOF_MUST_BE_AN_OBJECT = "Right value of 'instanceof' must be an object"
ECMA_ERR_SEARCH_STRING_CANNOT_BE_OF_TYPE_REGEXP = "Search string can't be of type: RegExp"
ECMA_ERR_SECOND_ARGUMENT_MUST_BE_AN_OBJECT = "Second argument must be an object"
ECMA_ERR_SPECIES_MUST_BE_A_CONSTRUCTOR = "Species must be a constructor"
ECMA_ERR_STACK_LIMIT_EXCEEDED = "Stack limit exceeded"
ECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER = "Start offset is outside the bounds of the buffer"
ECMA_ERR_STATIC_SNAPSHOTS_ARE_NOT_ENABLED = "Static snapshots are not enabled"
ECMA_ERR_STATIC_SNAPSHOTS_CANNOT_BE_COPIED_INTO_MEMORY = "Static snapshots cannot be copied into memory"
ECMA_ERR_STRING_CANNOT_BE_CONVERTED_TO_BIGINT_VALUE = "String cannot be converted to BigInt value"
ECMA_ERR_SUPER_BINDING_MUST_BE_A_CONSTRUCTOR = "Super binding must be a constructor"
ECMA_ERR_SUPER_CONSTRUCTOR_MAY_ONLY_BE_CALLED_ONCE = "Super constructor may only be called once"
ECMA_ERR_SYMBOL_IS_NOT_A_CONSTRUCTOR = "Symbol is not a constructor"
ECMA_ERR_TARGET_IS_NOT_OBJECT = "Target is not Object"
ECMA_ERR_TARGET_IS_NOT_WEAKREF = "Target is not weakRef"
ECMA_ERR_TARGET_NOT_EXTENSIBLE = "Target not extensible"
ECMA_ERR_TARGET_NOT_EXTENSIBLE_DIFFERENT_PROTOTYPE_RETURNED = "Target object is non-extensible and trap returned different prototype"
ECMA_ERR_THE_MAPFN_ARGUMENT_IS_NOT_CALLABLE = "The 'mapfn' argument is not callable"
ECMA_ERR_THE_GIVEN_ARGUMENT_IS_NOT_A_SYMBOL = "The given argument is not a Symbol"
ECMA_ERR_TARGET_PROPERTY_CONFIGURE_ACCESSOR_WITHOUT_SETTER = "The property of a Proxy target is a non configurable accessor without a setter"
ECMA_ERR_THE_REQUESTED_PROPERTY_UPDATE_CANNOT_BE_PERFORMED = "The requested property update cannot be performed"
ECMA_ERR_THE_STRUCTURE_IS_CYCLICAL = "The structure is cyclical"
ECMA_ERR_THE_TWO_DESCRIPTORS_ARE_INCOMPATIBLE = "The two descriptors are incompatible"
ECMA_ERR_TOO_MANY_ARGUMENTS_DECLARED_FOR_FUNCTION_APPLY = "Too many arguments declared for Function.apply"
ECMA_ERR_TRAP_IS_NEITHER_AN_OBJECT_NOR_UNDEFINED = "Trap is neither an object nor undefined"
ECMA_ERR_TRAP_MUST_RETURN_WITH_AN_OBJECT = "Trap must return with an object"
ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_CONFIGURABLE_KEYS = "Trap result did not include all configurable keys"
ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_NON_CONFIGURABLE_KEYS = "Trap result did not include all non-configurable keys"
ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_EXTENSIBILITY = "Trap result does not reflect extensibility of Proxy target"
ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_INEXTENSIBILITY = "Trap result does not reflect inextensibility of Proxy target"
ECMA_ERR_TRAP_EXTRA_KEYS_FOR_A_NON_EXTENSIBLE_TARGET = "Trap returned extra keys for a non-extensible Proxy target"
ECMA_ERR_TRAP_FALSISH_PROPERTY_TARGET_NOT_EXTENSIBLE = "Trap returned falsish for property but the proxy target is not extensible"
ECMA_ERR_TRAP_FALSISH_PROPERTY_NON_CONFIGURABLE = "Trap returned falsish for property which exists in the proxy target as non-configurable"
ECMA_ERR_TRAP_RETURNED_NEITHER_OBJECT_NOR_NULL = "Trap returned neither object nor null"
ECMA_ERR_TRAP_TRUISH_ADDING_PROPERTY_NON_EXTENSIBLE_TARGET = "Trap returned truish for adding property to the non-extensible target"
ECMA_ERR_TRAP_TRUISH_ADD_PROPERTY_INCOMPATIBLE_OTHER_PROP = "Trap returned truish for adding property that is incompatible with the existing property in the target"
ECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY = "Trap returned truish for defining non-configurable property which is non-existent in the target"
ECMA_ERR_TRAP_TRUISH_PROPERTY_NON_CONFIGURABLE = "Trap returned truish for property which is non-configurable in the proxy target"
ECMA_ERR_TRAP_TRUISH_TARGET_NOT_EXTENSIBLE = "Trap returned truish for target is not extensible"
ECMA_ERR_TRAP_WITH_DUPLICATED_ENTRIES = "Trap returned with duplicated entries"
ECMA_ERR_TYPEDARRAY_INTRINSTIC_CALLED_BY_NEW_EXPRESSION = "TypedArray intrinstic cannot be called by a 'new' expression"
ECMA_ERR_TYPEDARRAY_INTRINSTIC_DIRECTLY_CALLED = "TypedArray intrinstic cannot be directly called"
ECMA_ERR_CONTENTTYPE_RETURNED_TYPEDARRAY_NOT_MATCH_SOURCE = "TypedArray returned by [[ContentType]] does not match source"
ECMA_ERR_UNARY_PLUS_IS_NOT_ALLOWED_FOR_BIGINTS = "Unary plus is not allowed for BigInts"
ECMA_ERR_UNDEFINED_REFERENCE = "Undefined reference"
ECMA_ERR_UNEXPECTED_END_OF_PATTERN = "Unexpected end of pattern"
ECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING = "Unicode surrogate pair missing"
ECMA_ERR_UNMATCHED_CLOSE_BRACKET = "Unmatched close bracket"
ECMA_ERR_UNSHIFT_TOO_HIGH = "Unshift elements over 2**53-1 length is disallowed"
ECMA_ERR_UNSIGNED_RIGHT_SHIFT_IS_NOT_ALLOWED_FOR_BIGINTS = "Unsigned right shift is not allowed for BigInts"
ECMA_ERR_UNSUPPORTED_BINARY_OPERATION = "Unsupported binary operation"
ECMA_ERR_UNSUPPORTED_CONTAINER_OPERATION = "Unsupported container operation"
ECMA_ERR_UNSUPPORTED_SNAPSHOT_EXEC_FLAGS_ARE_SPECIFIED = "Unsupported snapshot exec flags are specified"
ECMA_ERR_UNTERMINATED_CHARACTER_CLASS = "Unterminated character class"
ECMA_ERR_UNTERMINATED_GROUP = "Unterminated group"
ECMA_ERR_VALUE_CANNOT_BE_CONVERTED_TO_BIGINT = "Value cannot be converted to BigInt"
ECMA_ERR_VALUE_FOR_CLASS_HERITAGE_IS_NOT_A_CONSTRUCTOR = "Value for class heritage is not a constructor"
ECMA_ERR_VALUE_RECEIVED_BY_FOR_ASYNC_OF_IS_NOT_OBJECT = "Value received by for-async-of is not object"
ECMA_ERR_VALUE_RECEIVED_BY_YIELD_IS_NOT_OBJECT = "Value received by yield* is not object"
ECMA_ERR_WEAKREF_TARGET_MUST_BE_AN_OBJECT = "WeakRef target must be an object"
ECMA_ERR_METHOD_RETURN_IS_NOT_CALLABLE = "method 'return' is not callable"
ECMA_ERR_VALUE_MSG = "Argument cannot be marked as error"
ECMA_ERR_WRONG_ARGS_MSG = "This type of argument is not allowed"
ECMA_ERR_PARSER_NOT_SUPPORTED = "Source code parsing is disabled"
ECMA_ERR_JSON_NOT_SUPPORTED = "JSON support is disabled"
ECMA_ERR_TYPED_ARRAY_NOT_SUPPORTED = "TypedArray support is disabled"
ECMA_ERR_SHARED_ARRAYBUFFER_NOT_SUPPORTED = "SharedArrayBuffer support is disabled"
ECMA_ERR_DATA_VIEW_NOT_SUPPORTED = "DataView support is disabled"
ECMA_ERR_BIGINT_NOT_SUPPORTED = "BigInt support is disabled"
ECMA_ERR_CONTAINER_NOT_SUPPORTED = "Container support is disabled"
ECMA_ERR_NOT_MODULE = "Argument is not a module"
ECMA_ERR_UNKNOWN_EXPORT = "Native module export not found"
ECMA_ERR_MODULE_NOT_SUPPORTED = "Module support is disabled"
ECMA_ERR_CALLBACK_IS_NOT_CALLABLE = "Callback function is not callable"
ECMA_ERR_ARRAYBUFFER_IS_DETACHED = "ArrayBuffer has been detached"
ECMA_ERR_CANNOT_CONVERT_TO_OBJECT = "Cannot convert undefined or null to object"
ECMA_ERR_CLASS_IS_NON_CONFIGURABLE = "Prototype property of a class is non-configurable"
ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT = "Argument is not an object"
ECMA_ERR_ARGUMENT_IS_NOT_A_PROXY = "Argument is not a Proxy object"
ECMA_ERR_TARGET_IS_NOT_A_CONSTRUCTOR = "Target is not a constructor"
ECMA_ERR_ARGUMENT_IS_NOT_AN_REGEXP = "Argument 'this' is not a RegExp object"
ECMA_ERR_INVALID_ARRAY_LENGTH = "Invalid Array length"
ECMA_ERR_LOCAL_VARIABLE_IS_REDECLARED = "Local variable is redeclared"
ECMA_ERR_EXPECTED_A_FUNCTION = "Expected a function"
ECMA_ERR_CLASS_CONSTRUCTOR_NEW = "Class constructor cannot be invoked without 'new'"
ECMA_ERR_LET_CONST_NOT_INITIALIZED = "Variables declared by let/const must be initialized before reading their value"
ECMA_ERR_MAXIMUM_SNAPSHOT_SIZE = "Maximum snapshot size reached"
ECMA_ERR_REGULAR_EXPRESSION_NOT_SUPPORTED = "Regular expression literals are not supported"
ECMA_ERR_SNAPSHOT_BUFFER_SMALL = "Snapshot buffer too small"
ECMA_ERR_SNAPSHOT_UNSUPPORTED_COMPILED_CODE = "Unsupported compiled code"
ECMA_ERR_SNAPSHOT_FLAG_NOT_SUPPORTED = "Unsupported generate snapshot flags specified"
ECMA_ERR_SNAPSHOT_SAVE_DISABLED = "Snapshot generation is disabled"
ECMA_ERR_SNAPSHOT_EXEC_DISABLED = "Snapshot execution is disabled"
ECMA_ERR_CANNOT_ALLOCATE_MEMORY_LITERALS = "Cannot allocate memory for literals"
ECMA_ERR_TAGGED_TEMPLATE_LITERALS = "Unsupported feature: tagged template literals"
ECMA_ERR_CONTAINER_NEEDED = "Value is not a Container or Iterator"
ECMA_ERR_INCORRECT_TYPE_CALL = "Operator called on incorrect container type"
ECMA_ERR_INVALID_TYPE_FOR_CONSTRUCTOR_CALL = "Invalid type for constructor call"
ECMA_ERR_SCRIPT_GLOBAL_FUNCTIONS_INVOKE_WITH_NEW = "Script (global) functions cannot be invoked with 'new'"
ECMA_ERR_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW = "Generator functions cannot be invoked with 'new'"
ECMA_ERR_ASYNC_FUNCTIONS_INVOKE_WITH_NEW = "Async functions cannot be invoked with 'new'"
ECMA_ERR_ASYNC_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW = "Async generator functions cannot be invoked with 'new'"
ECMA_ERR_ACCESSOR_FUNCTIONS_INVOKE_WITH_NEW = "Accessor functions cannot be invoked with 'new'"
ECMA_ERR_METHODS_INVOKE_WITH_NEW = "Methods cannot be invoked with 'new'"
ECMA_ERR_ARROW_FUNCTIONS_INVOKE_WITH_NEW = "Arrow functions cannot be invoked with 'new'"
ECMA_ERR_ASYNC_ARROW_FUNCTIONS_INVOKE_WITH_NEW = "Async arrow functions cannot be invoked with 'new'"
ECMA_ERR_PROXY_TARGET_IS_NOT_A_CONSTRUCTOR = "Proxy target is not a constructor"
ECMA_ERR_MAXIMUM_CALL_STACK_SIZE_EXCEEDED = "Maximum call stack size exceeded"
ECMA_ERR_INVALID_SNAPSHOT_FORMAT = "Invalid snapshot format"
ECMA_ERR_INVALID_SNAPSHOT_VERSION_OR_FEATURES = "Invalid snapshot version or unsupported features present"
ECMA_ERR_RECEIVER_MUST_BE_AN_OBJECT = "Receiver must be an object"
ECMA_ERR_CANNOT_DECLARE_SAME_PRIVATE_FIELD_TWICE = "Cannot declare same private field twice"
ECMA_ERR_CANNOT_WRITE_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT = "Cannot write private member to an object whose class did not declare it"
ECMA_ERR_PRIVATE_METHOD_IS_NOT_WRITABLE = "Private method is not writable"
ECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_SETTER = "Private field was defined without a setter"
ECMA_ERR_CANNOT_READ_PRIVATE_MEMBER_TO_AN_OBJECT_WHOSE_CLASS_DID_NOT_DECLARE_IT = "Cannot read private member to an object whose class did not declare it"
ECMA_ERR_PRIVATE_FIELD_WAS_DEFINED_WITHOUT_A_GETTER = "Private field was defined without a getter"
+71
View File
@@ -0,0 +1,71 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-errors.h"
#if JERRY_ERROR_MESSAGES
/**
* Struct to store ecma error message with its size.
*/
typedef struct
{
char *text; /* Text of ecma error message. */
uint8_t size; /* Size of ecma error message. */
} ecma_error_message_t;
/* Error message texts with size. */
static ecma_error_message_t ecma_error_messages[] JERRY_ATTR_CONST_DATA = {
{ "", 0 }, /* ECMA_ERR_EMPTY */
/** @cond doxygen_suppress */
#define ECMA_ERROR_DEF(id, string) { string, sizeof (string) - 1 },
#include "ecma-error-messages.inc.h"
#undef ECMA_ERROR_DEF
/** @endcond */
};
#endif /* JERRY_ERROR_MESSAGES */
/**
* Get specified ecma error as zero-terminated string
*
* @return pointer to zero-terminated ecma error
*/
const char *
ecma_get_error_msg (ecma_error_msg_t id) /**< ecma error id */
{
JERRY_ASSERT (id != ECMA_IS_VALID_CONSTRUCTOR);
#if JERRY_ERROR_MESSAGES
return ecma_error_messages[id].text;
#else /* !JERRY_ERROR_MESSAGES */
return NULL;
#endif /* JERRY_ERROR_MESSAGES */
} /* ecma_get_error_msg */
/**
* Get size of specified ecma error
*
* @return size in bytes
*/
lit_utf8_size_t
ecma_get_error_size (ecma_error_msg_t id) /**< ecma error id */
{
JERRY_ASSERT (id != ECMA_IS_VALID_CONSTRUCTOR);
#if JERRY_ERROR_MESSAGES
return ecma_error_messages[id].size;
#else /* !JERRY_ERROR_MESSAGES */
return 0;
#endif /* JERRY_ERROR_MESSAGES */
} /* ecma_get_error_size */
+39
View File
@@ -0,0 +1,39 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ECMA_ERRORS_H
#define ECMA_ERRORS_H
#include "lit-globals.h"
typedef enum
{
ECMA_ERR_EMPTY,
/** @cond doxygen_suppress */
#if JERRY_ERROR_MESSAGES
#define ECMA_ERROR_DEF(id, ascii_zt_string) id,
#else /* !JERRY_ERROR_MESSAGES */
#define ECMA_ERROR_DEF(id, ascii_zt_string) id = ECMA_ERR_EMPTY,
#endif /* JERRY_ERROR_MESSAGES */
#include "ecma-error-messages.inc.h"
#undef ECMA_ERROR_DEF
/** @endcond */
ECMA_IS_VALID_CONSTRUCTOR /* used as return value when checking constructor */
} ecma_error_msg_t;
const char* ecma_get_error_msg (ecma_error_msg_t id);
lit_utf8_size_t ecma_get_error_size (ecma_error_msg_t id);
#endif /* !ECMA_ERRORS_H */
+144
View File
@@ -0,0 +1,144 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-extended-info.h"
#include "ecma-helpers.h"
#include "byte-code.h"
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmaextendedinfo Extended info
* @{
*/
/**
* Decodes an uint32_t number, and updates the buffer position.
*
* @return the decoded value
*/
uint32_t
ecma_extended_info_decode_vlq (uint8_t **buffer_p) /**< [in/out] target buffer */
{
uint8_t *source_p = *buffer_p;
uint32_t value = 0;
do
{
source_p--;
value = (value << ECMA_EXTENDED_INFO_VLQ_SHIFT) | (*source_p & ECMA_EXTENDED_INFO_VLQ_MASK);
} while (*source_p & ECMA_EXTENDED_INFO_VLQ_CONTINUE);
*buffer_p = source_p;
return value;
} /* ecma_extended_info_decode_vlq */
/**
* Encodes an uint32_t number into a buffer.
*/
void
ecma_extended_info_encode_vlq (uint8_t **buffer_p, /**< target buffer */
uint32_t value) /**< encoded value */
{
uint8_t *destination_p = *buffer_p - 1;
if (value <= ECMA_EXTENDED_INFO_VLQ_MASK)
{
*destination_p = (uint8_t) value;
*buffer_p = destination_p;
return;
}
uint32_t length = 0;
uint32_t current_value = value >> ECMA_EXTENDED_INFO_VLQ_SHIFT;
do
{
current_value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT;
length++;
} while (current_value > 0);
destination_p -= length;
*buffer_p = destination_p;
do
{
*destination_p++ = (uint8_t) (value | ECMA_EXTENDED_INFO_VLQ_CONTINUE);
value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT;
} while (value > 0);
**buffer_p &= ECMA_EXTENDED_INFO_VLQ_MASK;
} /* ecma_extended_info_encode_vlq */
/**
* Gets the encoded length of a number.
*
* @return encoded length
*/
uint32_t
ecma_extended_info_get_encoded_length (uint32_t value) /**< encoded value */
{
uint32_t length = 0;
do
{
value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT;
length++;
} while (value > 0);
return length;
} /* ecma_extended_info_get_encoded_length */
/**
* Get the extended info from a byte code
*
* @return pointer to the extended info
*/
uint8_t *
ecma_compiled_code_resolve_extended_info (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */
{
JERRY_ASSERT (bytecode_header_p != NULL);
JERRY_ASSERT (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_EXTENDED_INFO);
ecma_value_t *base_p = ecma_compiled_code_resolve_arguments_start (bytecode_header_p);
if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) != CBC_FUNCTION_CONSTRUCTOR)
{
base_p--;
}
if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)
{
base_p--;
}
#if JERRY_LINE_INFO
if (bytecode_header_p->status_flags & CBC_CODE_FLAGS_HAS_LINE_INFO)
{
base_p--;
}
#endif /* JERRY_LINE_INFO */
JERRY_ASSERT (((uint8_t *) base_p)[-1] != 0);
return ((uint8_t *) base_p) - 1;
} /* ecma_compiled_code_resolve_extended_info */
/**
* @}
* @}
*/
+54
View File
@@ -0,0 +1,54 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ECMA_EXTENDED_INFO_H
#define ECMA_EXTENDED_INFO_H
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmaextendedinfo Extended info
* @{
*/
#include "ecma-globals.h"
/**
* Vlq encoding: flag which is set for all bytes except the last one.
*/
#define ECMA_EXTENDED_INFO_VLQ_CONTINUE 0x80
/**
* Vlq encoding: mask to decode the number fragment.
*/
#define ECMA_EXTENDED_INFO_VLQ_MASK 0x7f
/**
* Vlq encoding: number of bits stored in a byte.
*/
#define ECMA_EXTENDED_INFO_VLQ_SHIFT 7
uint32_t ecma_extended_info_decode_vlq (uint8_t **buffer_p);
void ecma_extended_info_encode_vlq (uint8_t **buffer_p, uint32_t value);
uint32_t ecma_extended_info_get_encoded_length (uint32_t value);
uint8_t *ecma_compiled_code_resolve_extended_info (const ecma_compiled_code_t *bytecode_header_p);
/**
* @}
* @}
*/
#endif /* !ECMA_EXTENDED_INFO_H */
File diff suppressed because it is too large Load Diff
+21 -7
View File
@@ -1,4 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,8 @@
#define ECMA_GC_H
#include "ecma-globals.h"
#include "jmem-allocator.h"
#include "jmem.h"
/** \addtogroup ecma ECMA
* @{
@@ -26,11 +27,24 @@
* @{
*/
extern void ecma_init_gc_info (ecma_object_t *);
extern void ecma_ref_object (ecma_object_t *);
extern void ecma_deref_object (ecma_object_t *);
extern void ecma_gc_run (jmem_free_unused_memory_severity_t);
extern void ecma_free_unused_memory (jmem_free_unused_memory_severity_t);
/**
* Free option flags
*/
typedef enum
{
ECMA_GC_FREE_NO_OPTIONS = 0, /**< no options */
ECMA_GC_FREE_SECOND_PROPERTY = (1 << 0), /**< free second property of a property pair */
ECMA_GC_FREE_REFERENCES = (1 << 1), /**< free references */
} ecma_gc_free_options_t;
void ecma_init_gc_info (ecma_object_t *object_p);
void ecma_ref_object (ecma_object_t *object_p);
void ecma_ref_object_inline (ecma_object_t *object_p);
void ecma_deref_object (ecma_object_t *object_p);
void ecma_gc_free_property (ecma_object_t *object_p, ecma_property_pair_t *prop_pair_p, uint32_t options);
void ecma_gc_free_properties (ecma_object_t *object_p, uint32_t options);
void ecma_gc_run (void);
void ecma_free_unused_memory (jmem_pressure_t pressure);
/**
* @}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,444 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-alloc.h"
#include "ecma-conversion.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "jrt.h"
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmahelpers Helpers for operations with ECMA data types
* @{
*/
/**
* Allocate a collection of ecma values.
*
* @return pointer to the collection
*/
ecma_collection_t *
ecma_new_collection (void)
{
ecma_collection_t *collection_p;
collection_p = (ecma_collection_t *) jmem_heap_alloc_block (sizeof (ecma_collection_t));
collection_p->item_count = 0;
collection_p->capacity = ECMA_COLLECTION_INITIAL_CAPACITY;
const uint32_t size = ECMA_COLLECTION_ALLOCATED_SIZE (ECMA_COLLECTION_INITIAL_CAPACITY);
collection_p->buffer_p = (ecma_value_t *) jmem_heap_alloc_block (size);
return collection_p;
} /* ecma_new_collection */
/**
* Deallocate a collection of ecma values without freeing it's values
*/
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_collection_destroy (ecma_collection_t *collection_p) /**< value collection */
{
JERRY_ASSERT (collection_p != NULL);
jmem_heap_free_block (collection_p->buffer_p, ECMA_COLLECTION_ALLOCATED_SIZE (collection_p->capacity));
jmem_heap_free_block (collection_p, sizeof (ecma_collection_t));
} /* ecma_collection_destroy */
/**
* Free the object collection elements and deallocate the collection
*/
void
ecma_collection_free_objects (ecma_collection_t *collection_p) /**< value collection */
{
JERRY_ASSERT (collection_p != NULL);
ecma_value_t *buffer_p = collection_p->buffer_p;
for (uint32_t i = 0; i < collection_p->item_count; i++)
{
if (ecma_is_value_object (buffer_p[i]))
{
ecma_deref_object (ecma_get_object_from_value (buffer_p[i]));
}
}
ecma_collection_destroy (collection_p);
} /* ecma_collection_free_objects */
/**
* Free the template literal objects and deallocate the collection
*/
void
ecma_collection_free_template_literal (ecma_collection_t *collection_p) /**< value collection */
{
for (uint32_t i = 0; i < collection_p->item_count; i++)
{
ecma_object_t *object_p = ecma_get_object_from_value (collection_p->buffer_p[i]);
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_ARRAY);
ecma_extended_object_t *array_object_p = (ecma_extended_object_t *) object_p;
JERRY_ASSERT (array_object_p->u.array.length_prop_and_hole_count & ECMA_ARRAY_TEMPLATE_LITERAL);
array_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_ARRAY_TEMPLATE_LITERAL;
ecma_property_value_t *property_value_p;
property_value_p = ecma_get_named_data_property (object_p, ecma_get_magic_string (LIT_MAGIC_STRING_RAW));
ecma_object_t *raw_object_p = ecma_get_object_from_value (property_value_p->value);
JERRY_ASSERT (ecma_get_object_type (raw_object_p) == ECMA_OBJECT_TYPE_ARRAY);
array_object_p = (ecma_extended_object_t *) raw_object_p;
JERRY_ASSERT (array_object_p->u.array.length_prop_and_hole_count & ECMA_ARRAY_TEMPLATE_LITERAL);
array_object_p->u.array.length_prop_and_hole_count &= (uint32_t) ~ECMA_ARRAY_TEMPLATE_LITERAL;
ecma_deref_object (raw_object_p);
ecma_deref_object (object_p);
}
ecma_collection_destroy (collection_p);
} /* ecma_collection_free_template_literal */
/**
* Free the non-object collection elements and deallocate the collection
*/
void
ecma_collection_free_if_not_object (ecma_collection_t *collection_p) /**< value collection */
{
JERRY_ASSERT (collection_p != NULL);
ecma_value_t *buffer_p = collection_p->buffer_p;
for (uint32_t i = 0; i < collection_p->item_count; i++)
{
ecma_free_value_if_not_object (buffer_p[i]);
}
ecma_collection_destroy (collection_p);
} /* ecma_collection_free_if_not_object */
/**
* Free the collection elements and deallocate the collection
*/
void
ecma_collection_free (ecma_collection_t *collection_p) /**< value collection */
{
JERRY_ASSERT (collection_p != NULL);
ecma_value_t *buffer_p = collection_p->buffer_p;
for (uint32_t i = 0; i < collection_p->item_count; i++)
{
ecma_free_value (buffer_p[i]);
}
ecma_collection_destroy (collection_p);
} /* ecma_collection_free */
/**
* Append new value to ecma values collection
*
* Note: The reference count of the values are not increased
*/
void
ecma_collection_push_back (ecma_collection_t *collection_p, /**< value collection */
ecma_value_t value) /**< ecma value to append */
{
JERRY_ASSERT (collection_p != NULL);
ecma_value_t *buffer_p = collection_p->buffer_p;
if (JERRY_LIKELY (collection_p->item_count < collection_p->capacity))
{
buffer_p[collection_p->item_count++] = value;
return;
}
const uint32_t new_capacity = collection_p->capacity + ECMA_COLLECTION_GROW_FACTOR;
const uint32_t old_size = ECMA_COLLECTION_ALLOCATED_SIZE (collection_p->capacity);
const uint32_t new_size = ECMA_COLLECTION_ALLOCATED_SIZE (new_capacity);
buffer_p = jmem_heap_realloc_block (buffer_p, old_size, new_size);
buffer_p[collection_p->item_count++] = value;
collection_p->capacity = new_capacity;
collection_p->buffer_p = buffer_p;
} /* ecma_collection_push_back */
/**
* Reserve space for the given amount of ecma_values in the collection
*/
void
ecma_collection_reserve (ecma_collection_t *collection_p, /**< value collection */
uint32_t count) /**< number of ecma values to reserve */
{
JERRY_ASSERT (collection_p != NULL);
JERRY_ASSERT (UINT32_MAX - count > collection_p->capacity);
const uint32_t new_capacity = collection_p->capacity + count;
const uint32_t old_size = ECMA_COLLECTION_ALLOCATED_SIZE (collection_p->capacity);
const uint32_t new_size = ECMA_COLLECTION_ALLOCATED_SIZE (new_capacity);
ecma_value_t *buffer_p = collection_p->buffer_p;
buffer_p = jmem_heap_realloc_block (buffer_p, old_size, new_size);
collection_p->capacity = new_capacity;
collection_p->buffer_p = buffer_p;
} /* ecma_collection_reserve */
/**
* Append a list of values to the end of the collection
*/
void
ecma_collection_append (ecma_collection_t *collection_p, /**< value collection */
const ecma_value_t *buffer_p, /**< values to append */
uint32_t count) /**< number of ecma values to append */
{
JERRY_ASSERT (collection_p != NULL);
JERRY_ASSERT (collection_p->capacity >= collection_p->item_count);
uint32_t free_count = collection_p->capacity - collection_p->item_count;
if (free_count < count)
{
ecma_collection_reserve (collection_p, count - free_count);
}
memcpy (collection_p->buffer_p + collection_p->item_count, buffer_p, count * sizeof (ecma_value_t));
collection_p->item_count += count;
} /* ecma_collection_append */
/**
* Helper function to check if a given collection have duplicated properties or not
*
* @return true - if there are duplicated properties in the collection
* false - otherwise
*/
bool
ecma_collection_check_duplicated_entries (ecma_collection_t *collection_p) /**< prop name collection */
{
if (collection_p->item_count == 0)
{
return false;
}
ecma_value_t *buffer_p = collection_p->buffer_p;
for (uint32_t i = 0; i < collection_p->item_count - 1; i++)
{
ecma_string_t *current_name_p = ecma_get_prop_name_from_value (buffer_p[i]);
for (uint32_t j = i + 1; j < collection_p->item_count; j++)
{
if (ecma_compare_ecma_strings (current_name_p, ecma_get_prop_name_from_value (buffer_p[j])))
{
return true;
}
}
}
return false;
} /* ecma_collection_check_duplicated_entries */
/**
* Check the string value existance in the collection.
*
* Used by:
* - ecma_builtin_json_stringify step 4.b.ii.5
* - ecma_op_object_enumerate
*
* @return true, if the string is already in the collection.
*/
bool
ecma_collection_has_string_value (ecma_collection_t *collection_p, /**< collection */
ecma_string_t *string_p) /**< string */
{
ecma_value_t *buffer_p = collection_p->buffer_p;
for (uint32_t i = 0; i < collection_p->item_count; i++)
{
ecma_string_t *current_p = ecma_get_string_from_value (buffer_p[i]);
if (ecma_compare_ecma_strings (current_p, string_p))
{
return true;
}
}
return false;
} /* ecma_collection_has_string_value */
/**
* Initial capacity of an ecma-collection
*/
#define ECMA_COMPACT_COLLECTION_GROWTH 8
/**
* Set the size of the compact collection
*/
#define ECMA_COMPACT_COLLECTION_SET_SIZE(compact_collection_p, item_count, unused_items) \
((compact_collection_p)[0] = (((item_count) << ECMA_COMPACT_COLLECTION_SIZE_SHIFT) | (unused_items)))
/**
* Set the size of the compact collection
*/
#define ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT(compact_collection_p) \
((compact_collection_p)[0] & ((1 << ECMA_COMPACT_COLLECTION_SIZE_SHIFT) - 1))
/**
* Allocate a compact collection of ecma values
*
* @return pointer to the compact collection
*/
ecma_value_t *
ecma_new_compact_collection (void)
{
size_t size = (ECMA_COMPACT_COLLECTION_GROWTH / 2) * sizeof (ecma_value_t);
ecma_value_t *compact_collection_p = (ecma_value_t *) jmem_heap_alloc_block (size);
ECMA_COMPACT_COLLECTION_SET_SIZE (compact_collection_p,
ECMA_COMPACT_COLLECTION_GROWTH / 2,
(ECMA_COMPACT_COLLECTION_GROWTH / 2) - 1);
return compact_collection_p;
} /* ecma_new_compact_collection */
/**
* Append a value to the compact collection
*
* @return updated pointer to the compact collection
*/
ecma_value_t *
ecma_compact_collection_push_back (ecma_value_t *compact_collection_p, /**< compact collection */
ecma_value_t value) /**< ecma value to append */
{
ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);
ecma_value_t unused_items = ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT (compact_collection_p);
if (unused_items > 0)
{
compact_collection_p[size - unused_items] = value;
(*compact_collection_p)--;
return compact_collection_p;
}
if (size == ECMA_COMPACT_COLLECTION_GROWTH / 2)
{
size_t old_size = (ECMA_COMPACT_COLLECTION_GROWTH / 2) * sizeof (ecma_value_t);
size_t new_size = ECMA_COMPACT_COLLECTION_GROWTH * sizeof (ecma_value_t);
compact_collection_p = jmem_heap_realloc_block (compact_collection_p, old_size, new_size);
compact_collection_p[ECMA_COMPACT_COLLECTION_GROWTH / 2] = value;
ECMA_COMPACT_COLLECTION_SET_SIZE (compact_collection_p,
ECMA_COMPACT_COLLECTION_GROWTH,
(ECMA_COMPACT_COLLECTION_GROWTH / 2) - 1);
return compact_collection_p;
}
size_t old_size = size * sizeof (ecma_value_t);
size_t new_size = old_size + (ECMA_COMPACT_COLLECTION_GROWTH * sizeof (ecma_value_t));
compact_collection_p = jmem_heap_realloc_block (compact_collection_p, old_size, new_size);
compact_collection_p[size] = value;
ECMA_COMPACT_COLLECTION_SET_SIZE (compact_collection_p,
size + ECMA_COMPACT_COLLECTION_GROWTH,
ECMA_COMPACT_COLLECTION_GROWTH - 1);
return compact_collection_p;
} /* ecma_compact_collection_push_back */
/**
* Discard the unused elements of a compact collection
*
* Note:
* further items should not be added after this call
*
* @return updated pointer to the compact collection
*/
ecma_value_t *
ecma_compact_collection_shrink (ecma_value_t *compact_collection_p) /**< compact collection */
{
ecma_value_t unused_items = ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT (compact_collection_p);
if (unused_items == 0)
{
return compact_collection_p;
}
ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);
size_t old_size = size * sizeof (ecma_value_t);
size_t new_size = (size - unused_items) * sizeof (ecma_value_t);
compact_collection_p = jmem_heap_realloc_block (compact_collection_p, old_size, new_size);
ECMA_COMPACT_COLLECTION_SET_SIZE (compact_collection_p, size - unused_items, 0);
return compact_collection_p;
} /* ecma_compact_collection_shrink */
/**
* Free a compact collection
*/
void
ecma_compact_collection_free (ecma_value_t *compact_collection_p) /**< compact collection */
{
ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);
ecma_value_t unused_items = ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT (compact_collection_p);
ecma_value_t *end_p = compact_collection_p + size - unused_items;
ecma_value_t *current_p = compact_collection_p + 1;
while (current_p < end_p)
{
ecma_free_value (*current_p++);
}
jmem_heap_free_block (compact_collection_p, size * sizeof (ecma_value_t));
} /* ecma_compact_collection_free */
/**
* Get the end of a compact collection
*
* @return pointer to the compact collection end
*/
ecma_value_t *
ecma_compact_collection_end (ecma_value_t *compact_collection_p) /**< compact collection */
{
ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);
ecma_value_t unused_items = ECMA_COMPACT_COLLECTION_GET_UNUSED_ITEM_COUNT (compact_collection_p);
return compact_collection_p + size - unused_items;
} /* ecma_compact_collection_end */
/**
* Destroy a compact collection
*/
void
ecma_compact_collection_destroy (ecma_value_t *compact_collection_p) /**< compact collection */
{
ecma_value_t size = ECMA_COMPACT_COLLECTION_GET_SIZE (compact_collection_p);
jmem_heap_free_block (compact_collection_p, size * sizeof (ecma_value_t));
} /* ecma_compact_collection_destroy */
/**
* @}
* @}
*/
File diff suppressed because it is too large Load Diff
+19 -15
View File
@@ -1,5 +1,4 @@
/* Copyright 2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +38,6 @@
#include <math.h>
#include "config.h"
#include "ecma-helpers.h"
/** \addtogroup ecma ECMA
@@ -56,11 +54,17 @@
*/
/**
* Floating point format definitions
* Floating point format definitions (next float value)
*/
#define ECMA_NEXT_FLOAT(value) (nextafter ((value), INFINITY))
/**
* Floating point format definitions (previous float value)
*/
#define ECMA_PREV_FLOAT(value) (nextafter ((value), -INFINITY))
/**
* Value of epsilon
*/
#define ERROL0_EPSILON 0.0000001
/**
@@ -75,7 +79,7 @@ typedef struct
/**
* Normalize the number by factoring in the error.
*/
static inline void __attr_always_inline___
static inline void JERRY_ATTR_ALWAYS_INLINE
ecma_normalize_high_prec_data (ecma_high_prec_t *hp_data_p) /**< [in, out] float pair */
{
double val = hp_data_p->value;
@@ -87,7 +91,7 @@ ecma_normalize_high_prec_data (ecma_high_prec_t *hp_data_p) /**< [in, out] float
/**
* Multiply the high-precision number by ten.
*/
static inline void __attr_always_inline___
static inline void JERRY_ATTR_ALWAYS_INLINE
ecma_multiply_high_prec_by_10 (ecma_high_prec_t *hp_data_p) /**< [in, out] high-precision number */
{
double value = hp_data_p->value;
@@ -129,13 +133,13 @@ ecma_divide_high_prec_by_10 (ecma_high_prec_t *hp_data_p) /**< [in, out] high-pr
*
* @return number of generated digits
*/
inline lit_utf8_size_t __attr_always_inline___
extern inline lit_utf8_size_t JERRY_ATTR_ALWAYS_INLINE
ecma_errol0_dtoa (double val, /**< ecma number */
lit_utf8_byte_t *buffer_p, /**< buffer to generate digits into */
int32_t *exp_p) /**< [out] exponent */
{
double power_of_10 = 1.0;
int32_t exp = 1;
int32_t exponent = 1;
/* normalize the midpoint */
ecma_high_prec_t mid;
@@ -143,16 +147,16 @@ ecma_errol0_dtoa (double val, /**< ecma number */
mid.value = val;
mid.offset = 0.0;
while (((mid.value > 10.0) || ((mid.value == 10.0) && (mid.offset >= 0.0))) && (exp < 308))
while (((mid.value > 10.0) || ((mid.value == 10.0) && (mid.offset >= 0.0))) && (exponent < 308))
{
exp++;
exponent++;
ecma_divide_high_prec_by_10 (&mid);
power_of_10 /= 10.0;
}
while (((mid.value < 1.0) || ((mid.value == 1.0) && (mid.offset < 0.0))) && (exp > -307))
while (((mid.value < 1.0) || ((mid.value == 1.0) && (mid.offset < 0.0))) && (exponent > -307))
{
exp--;
exponent--;
ecma_multiply_high_prec_by_10 (&mid);
power_of_10 *= 10.0;
}
@@ -177,14 +181,14 @@ ecma_errol0_dtoa (double val, /**< ecma number */
while (high_bound.value > 10.0 || (high_bound.value == 10.0 && (high_bound.offset >= 0.0)))
{
exp++;
exponent++;
ecma_divide_high_prec_by_10 (&high_bound);
ecma_divide_high_prec_by_10 (&low_bound);
}
while (high_bound.value < 1.0 || (high_bound.value == 1.0 && (high_bound.offset < 0.0)))
{
exp--;
exponent--;
ecma_multiply_high_prec_by_10 (&high_bound);
ecma_multiply_high_prec_by_10 (&low_bound);
}
@@ -226,7 +230,7 @@ ecma_errol0_dtoa (double val, /**< ecma number */
double mdig = (high_bound.value + low_bound.value) / 2.0 + 0.5;
*dst_p++ = (lit_utf8_byte_t) ('0' + (uint8_t) mdig);
*exp_p = exp;
*exp_p = exponent;
return (lit_utf8_size_t) (dst_p - buffer_p);
} /* ecma_errol0_dtoa */
@@ -1,5 +1,4 @@
/* Copyright 2015-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,8 +14,11 @@
*/
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects-general.h"
#include "ecma-objects.h"
/** \addtogroup ecma ECMA
* @{
@@ -26,141 +28,305 @@
*/
/**
* Create internal property with specified identifier and store external pointer in the property.
*
* Note:
* property identifier should be one of the following:
* - ECMA_INTERNAL_PROPERTY_NATIVE_HANDLE;
* - ECMA_INTERNAL_PROPERTY_FREE_CALLBACK.
* Create a native pointer property to store the native pointer and its type info.
*
* @return true - if property was just created with specified value,
* false - otherwise, if property existed before the call, it's value was updated.
* false - otherwise, if property existed before the call, it's value was updated
*/
bool
ecma_create_external_pointer_property (ecma_object_t *obj_p, /**< object to create property in */
ecma_internal_property_id_t id, /**< identifier of internal
* property to create */
ecma_external_pointer_t ptr_value) /**< value to store in the property */
ecma_create_native_pointer_property (ecma_object_t *obj_p, /**< object to create property in */
void *native_p, /**< native pointer */
const jerry_object_native_info_t *native_info_p) /**< native type info */
{
JERRY_ASSERT (id == ECMA_INTERNAL_PROPERTY_NATIVE_HANDLE
|| id == ECMA_INTERNAL_PROPERTY_FREE_CALLBACK);
ecma_string_t *name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER);
bool is_new;
ecma_property_t *prop_p = ecma_find_internal_property (obj_p, id);
if (prop_p == NULL)
if (native_info_p != NULL && native_info_p->number_of_references > 0)
{
prop_p = ecma_create_internal_property (obj_p, id);
name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES);
}
is_new = true;
if (ecma_op_object_is_fast_array (obj_p))
{
ecma_fast_array_convert_to_normal (obj_p);
}
ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);
bool is_new = (property_p == NULL);
ecma_native_pointer_t *native_pointer_p;
if (property_p == NULL)
{
native_pointer_p = (ecma_native_pointer_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_t));
ecma_property_value_t *value_p;
ECMA_CREATE_INTERNAL_PROPERTY (obj_p, name_p, property_p, value_p);
ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, native_pointer_p);
*property_p |= ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;
}
else if (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL)
{
ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value);
if (native_pointer_p->native_info_p == native_info_p)
{
native_pointer_p->native_p = native_p;
return false;
}
value_p->value = JMEM_CP_NULL;
(void) value_p->value; /* Make cppcheck happy. */
*property_p &= (ecma_property_t) ~ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;
ecma_native_pointer_chain_t *item_p;
item_p = (ecma_native_pointer_chain_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_chain_t));
item_p->data = *native_pointer_p;
jmem_heap_free_block (native_pointer_p, sizeof (ecma_native_pointer_t));
item_p->next_p = (ecma_native_pointer_chain_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_chain_t));
item_p->next_p->next_p = NULL;
native_pointer_p = &item_p->next_p->data;
ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, item_p);
}
else
{
is_new = false;
ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
if (value_p->value == JMEM_CP_NULL)
{
native_pointer_p = (ecma_native_pointer_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_t));
ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, native_pointer_p);
*property_p |= ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;
}
else
{
ecma_native_pointer_chain_t *item_p;
item_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_chain_t, value_p->value);
/* There should be at least 2 native pointers in the chain */
JERRY_ASSERT (item_p != NULL && item_p->next_p != NULL);
while (true)
{
if (item_p->data.native_info_p == native_info_p)
{
/* The native info already exists -> update the corresponding data */
item_p->data.native_p = native_p;
return false;
}
if (item_p->next_p == NULL)
{
/* The native info does not exist -> append a new element to the chain */
break;
}
item_p = item_p->next_p;
}
ecma_native_pointer_chain_t *new_item_p;
new_item_p = (ecma_native_pointer_chain_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_chain_t));
item_p->next_p = new_item_p;
new_item_p->next_p = NULL;
native_pointer_p = &new_item_p->data;
}
}
JERRY_STATIC_ASSERT (sizeof (uint32_t) <= sizeof (ECMA_PROPERTY_VALUE_PTR (prop_p)->value),
size_of_internal_property_value_must_be_greater_than_or_equal_to_4_bytes);
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
ECMA_PROPERTY_VALUE_PTR (prop_p)->value = (ecma_value_t) ptr_value;
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
ecma_external_pointer_t *handler_p;
if (is_new)
{
handler_p = ecma_alloc_external_pointer ();
ECMA_SET_NON_NULL_POINTER (ECMA_PROPERTY_VALUE_PTR (prop_p)->value, handler_p);
}
else
{
handler_p = ECMA_GET_NON_NULL_POINTER (ecma_external_pointer_t,
ECMA_PROPERTY_VALUE_PTR (prop_p)->value);
}
*handler_p = ptr_value;
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
native_pointer_p->native_p = native_p;
native_pointer_p->native_info_p = (jerry_object_native_info_t *) native_info_p;
return is_new;
} /* ecma_create_external_pointer_property */
} /* ecma_create_native_pointer_property */
/**
* Get value of external pointer stored in the object's property with specified identifier
* Get value of native package stored in the object's property with specified identifier
*
* Note:
* property identifier should be one of the following:
* - ECMA_INTERNAL_PROPERTY_NATIVE_HANDLE;
* - ECMA_INTERNAL_PROPERTY_FREE_CALLBACK.
* - LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER
*
* @return true - if property exists and it's value is returned through out_pointer_p,
* false - otherwise (value returned through out_pointer_p is NULL).
* @return native pointer data if property exists
* NULL otherwise
*/
ecma_native_pointer_t *
ecma_get_native_pointer_value (ecma_object_t *obj_p, /**< object to get property value from */
const jerry_object_native_info_t *native_info_p) /**< native type info */
{
if (ecma_op_object_is_fast_array (obj_p))
{
/* Fast access mode array can not have native pointer properties */
return NULL;
}
ecma_string_t *name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER);
if (native_info_p != NULL && native_info_p->number_of_references > 0)
{
name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES);
}
ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);
if (property_p == NULL)
{
return NULL;
}
ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
if (JERRY_LIKELY (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL))
{
ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value);
if (native_pointer_p->native_info_p == native_info_p)
{
return native_pointer_p;
}
return NULL;
}
if (value_p->value == JMEM_CP_NULL)
{
return NULL;
}
ecma_native_pointer_chain_t *item_p;
item_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_chain_t, value_p->value);
/* There should be at least 2 native pointers in the chain */
JERRY_ASSERT (item_p != NULL && item_p->next_p != NULL);
do
{
if (item_p->data.native_info_p == native_info_p)
{
return &item_p->data;
}
item_p = item_p->next_p;
} while (item_p != NULL);
return NULL;
} /* ecma_get_native_pointer_value */
/**
* Delete the previously set native pointer by the native type info from the specified object.
*
* Note:
* If the specified object has no matching native pointer for the given native type info
* the function has no effect.
*
* @return true - if the native pointer has been deleted succesfully
* false - otherwise
*/
bool
ecma_get_external_pointer_value (ecma_object_t *obj_p, /**< object to get property value from */
ecma_internal_property_id_t id, /**< identifier of internal property
* to get value from */
ecma_external_pointer_t *out_pointer_p) /**< [out] value of the external pointer */
ecma_delete_native_pointer_property (ecma_object_t *obj_p, /**< object to delete property from */
const jerry_object_native_info_t *native_info_p) /**< native type info */
{
JERRY_ASSERT (id == ECMA_INTERNAL_PROPERTY_NATIVE_HANDLE
|| id == ECMA_INTERNAL_PROPERTY_FREE_CALLBACK);
ecma_property_t *prop_p = ecma_find_internal_property (obj_p, id);
if (prop_p == NULL)
if (ecma_op_object_is_fast_array (obj_p))
{
*out_pointer_p = (ecma_external_pointer_t) NULL;
/* Fast access mode array can not have native pointer properties */
return false;
}
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
ecma_string_t *name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER);
*out_pointer_p = ECMA_PROPERTY_VALUE_PTR (prop_p)->value;
if (native_info_p != NULL && native_info_p->number_of_references > 0)
{
name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER_WITH_REFERENCES);
}
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);
ecma_external_pointer_t *handler_p = ECMA_GET_NON_NULL_POINTER (ecma_external_pointer_t,
ECMA_PROPERTY_VALUE_PTR (prop_p)->value);
*out_pointer_p = *handler_p;
if (property_p == NULL)
{
return false;
}
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
ecma_property_value_t *value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
return true;
} /* ecma_get_external_pointer_value */
if (JERRY_LIKELY (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL))
{
ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value);
/**
* Free memory associated with external pointer stored in the property
*
* Note:
* property identifier should be one of the following:
* - ECMA_INTERNAL_PROPERTY_NATIVE_HANDLE;
* - ECMA_INTERNAL_PROPERTY_FREE_CALLBACK.
*/
void
ecma_free_external_pointer_in_property (ecma_property_t *prop_p) /**< internal property */
{
JERRY_ASSERT (ECMA_PROPERTY_GET_INTERNAL_PROPERTY_TYPE (prop_p) == ECMA_INTERNAL_PROPERTY_NATIVE_HANDLE
|| ECMA_PROPERTY_GET_INTERNAL_PROPERTY_TYPE (prop_p) == ECMA_INTERNAL_PROPERTY_FREE_CALLBACK);
if (native_pointer_p->native_info_p != native_info_p)
{
return false;
}
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
value_p->value = JMEM_CP_NULL;
*property_p &= (ecma_property_t) ~ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;
jmem_heap_free_block (native_pointer_p, sizeof (ecma_native_pointer_t));
return true;
}
/* no additional memory was allocated for the pointer storage */
if (value_p->value == JMEM_CP_NULL)
{
return false;
}
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
ecma_native_pointer_chain_t *first_p;
first_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_chain_t, value_p->value);
ecma_external_pointer_t *handler_p = ECMA_GET_NON_NULL_POINTER (ecma_external_pointer_t,
ECMA_PROPERTY_VALUE_PTR (prop_p)->value);
/* There should be at least 2 native pointers in the chain */
JERRY_ASSERT (first_p != NULL && first_p->next_p != NULL);
ecma_dealloc_external_pointer (handler_p);
ecma_native_pointer_chain_t *item_p = first_p;
ecma_native_pointer_chain_t *prev_p = NULL;
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
do
{
if (item_p->data.native_info_p == native_info_p)
{
if (prev_p == NULL)
{
/* The first element is deleted from the chain: change the property value. */
first_p = item_p->next_p;
ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, first_p);
}
else
{
/* A non-first element is deleted from the chain: update the previous pointer. */
prev_p->next_p = item_p->next_p;
}
} /* ecma_free_external_pointer_in_property */
jmem_heap_free_block (item_p, sizeof (ecma_native_pointer_chain_t));
if (first_p->next_p != NULL)
{
return true;
}
/* Only one item remained. The ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL flag is
* set early to avoid using the chain if the allocation below triggers a GC. */
*property_p |= ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL;
ecma_native_pointer_t *native_pointer_p;
native_pointer_p = (ecma_native_pointer_t *) jmem_heap_alloc_block (sizeof (ecma_native_pointer_t));
*native_pointer_p = first_p->data;
ECMA_SET_INTERNAL_VALUE_POINTER (value_p->value, native_pointer_p);
jmem_heap_free_block (first_p, sizeof (ecma_native_pointer_chain_t));
return true;
}
prev_p = item_p;
item_p = item_p->next_p;
} while (item_p != NULL);
return false;
} /* ecma_delete_native_pointer_property */
/**
* @}
File diff suppressed because it is too large Load Diff
+245
View File
@@ -0,0 +1,245 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ECMA_HELPERS_NUMBER_H
#define ECMA_HELPERS_NUMBER_H
#include "ecma-globals.h"
#include "config.h"
/**
* Binary representation of an ecma-number
*/
#if JERRY_NUMBER_TYPE_FLOAT64
typedef uint64_t ecma_binary_num_t;
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
typedef uint32_t ecma_binary_num_t;
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Makes it possible to read/write the binary representation of an ecma_number_t
* without strict aliasing rule violation.
*/
typedef union
{
ecma_number_t as_number; /**< ecma-number */
ecma_binary_num_t as_binary; /**< binary representation */
} ecma_number_accessor_t;
ecma_binary_num_t ecma_number_to_binary (ecma_number_t number);
ecma_number_t ecma_number_from_binary (ecma_binary_num_t binary);
bool ecma_number_sign (ecma_binary_num_t binary);
uint32_t ecma_number_biased_exp (ecma_binary_num_t binary);
uint64_t ecma_number_fraction (ecma_binary_num_t binary);
ecma_number_t ecma_number_create (bool sign, uint32_t biased_exp, uint64_t fraction);
/**
* Maximum number of significant decimal digits that an ecma-number can store
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_MAX_DIGITS (19)
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_MAX_DIGITS (9)
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Width of sign field
*
* See also:
* IEEE-754 2008, 3.6, Table 3.5
*/
#define ECMA_NUMBER_SIGN_WIDTH (1)
/**
* Width of biased exponent field
*
* See also:
* IEEE-754 2008, 3.6, Table 3.5
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_BIASED_EXP_WIDTH (11)
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_BIASED_EXP_WIDTH (8)
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Exponent bias
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_EXPONENT_BIAS (1023)
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_EXPONENT_BIAS (127)
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Width of fraction field
*
* See also:
* IEEE-754 2008, 3.6, Table 3.5
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_FRACTION_WIDTH (52)
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_FRACTION_WIDTH (23)
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Sign bit in ecma-numbers
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_SIGN_BIT 0x8000000000000000ull
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_SIGN_BIT 0x7f800000u;
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Binary representation of an IEEE-754 QNaN value.
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_BINARY_QNAN 0x7ff8000000000000ull
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_BINARY_QNAN 0x7fc00000u
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Binary representation of an IEEE-754 Infinity value.
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_BINARY_INF 0x7ff0000000000000ull
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_BINARY_INF 0x7f800000u
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Binary representation of an IEEE-754 zero value.
*/
#define ECMA_NUMBER_BINARY_ZERO 0x0ull
/**
* Number.MIN_VALUE (i.e., the smallest positive value of ecma-number)
*
* See also: ECMA_262 v5, 15.7.3.3
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_MIN_VALUE ((ecma_number_t) 5e-324)
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_MIN_VALUE (FLT_MIN)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Number.MAX_VALUE (i.e., the maximum value of ecma-number)
*
* See also: ECMA_262 v5, 15.7.3.2
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_MAX_VALUE ((ecma_number_t) 1.7976931348623157e+308)
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_MAX_VALUE (FLT_MAX)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Number.EPSILON
*
* See also: ECMA_262 v6, 20.1.2.1
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_EPSILON ((ecma_number_t) 2.2204460492503130808472633361816e-16)
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_EPSILON ((ecma_number_t) 1.1920928955078125e-7)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Number.MAX_SAFE_INTEGER
*
* See also: ECMA_262 v6, 20.1.2.6
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0x1FFFFFFFFFFFFF)
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0xFFFFFF)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Number.MIN_SAFE_INTEGER
*
* See also: ECMA_262 v6, 20.1.2.8
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0x1FFFFFFFFFFFFF)
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0xFFFFFF)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Number.MAX_VALUE exponent part
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define NUMBER_MAX_DECIMAL_EXPONENT 308
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define NUMBER_MAX_DECIMAL_EXPONENT 38
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Number.MIN_VALUE exponent part
*/
#if JERRY_NUMBER_TYPE_FLOAT64
#define NUMBER_MIN_DECIMAL_EXPONENT -324
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
#define NUMBER_MIN_DECIMAL_EXPONENT -45
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Euler number
*/
#define ECMA_NUMBER_E ((ecma_number_t) 2.7182818284590452354)
/**
* Natural logarithm of 10
*/
#define ECMA_NUMBER_LN10 ((ecma_number_t) 2.302585092994046)
/**
* Natural logarithm of 2
*/
#define ECMA_NUMBER_LN2 ((ecma_number_t) 0.6931471805599453)
/**
* Logarithm base 2 of the Euler number
*/
#define ECMA_NUMBER_LOG2E ((ecma_number_t) 1.4426950408889634)
/**
* Logarithm base 10 of the Euler number
*/
#define ECMA_NUMBER_LOG10E ((ecma_number_t) 0.4342944819032518)
/**
* Pi number
*/
#define ECMA_NUMBER_PI ((ecma_number_t) 3.1415926535897932)
/**
* Square root of 0.5
*/
#define ECMA_NUMBER_SQRT_1_2 ((ecma_number_t) 0.7071067811865476)
/**
* Square root of 2
*/
#define ECMA_NUMBER_SQRT2 ((ecma_number_t) 1.4142135623730951)
#endif /* !ECMA_HELPERS_NUMBER_H */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,374 +0,0 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-alloc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "jrt.h"
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmahelpers Helpers for operations with ECMA data types
* @{
*/
/**
* Allocate a collection of ecma values.
*
* @return pointer to the collection's header
*/
ecma_collection_header_t *
ecma_new_values_collection (const ecma_value_t values_buffer[], /**< ecma values */
ecma_length_t values_number, /**< number of ecma values */
bool do_ref_if_object) /**< if the value is object value,
increase reference counter of the object */
{
JERRY_ASSERT (values_buffer != NULL || values_number == 0);
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
ecma_collection_header_t *header_p = ecma_alloc_collection_header ();
header_p->unit_number = values_number;
jmem_cpointer_t *next_chunk_cp_p = &header_p->first_chunk_cp;
ecma_collection_chunk_t *last_chunk_p = NULL;
ecma_value_t *cur_value_buf_iter_p = NULL;
ecma_value_t *cur_value_buf_end_p = NULL;
for (ecma_length_t value_index = 0;
value_index < values_number;
value_index++)
{
if (cur_value_buf_iter_p == cur_value_buf_end_p)
{
ecma_collection_chunk_t *chunk_p = ecma_alloc_collection_chunk ();
ECMA_SET_POINTER (*next_chunk_cp_p, chunk_p);
next_chunk_cp_p = &chunk_p->next_chunk_cp;
cur_value_buf_iter_p = (ecma_value_t *) chunk_p->data;
cur_value_buf_end_p = cur_value_buf_iter_p + values_in_chunk;
last_chunk_p = chunk_p;
}
JERRY_ASSERT (cur_value_buf_iter_p + 1 <= cur_value_buf_end_p);
if (do_ref_if_object)
{
*cur_value_buf_iter_p++ = ecma_copy_value (values_buffer[value_index]);
}
else
{
*cur_value_buf_iter_p++ = ecma_copy_value_if_not_object (values_buffer[value_index]);
}
}
*next_chunk_cp_p = ECMA_NULL_POINTER;
ECMA_SET_POINTER (header_p->last_chunk_cp, last_chunk_p);
return header_p;
} /* ecma_new_values_collection */
/**
* Free the collection of ecma values.
*/
void
ecma_free_values_collection (ecma_collection_header_t *header_p, /**< collection's header */
bool do_deref_if_object) /**< if the value is object value,
decrement reference counter of the object */
{
JERRY_ASSERT (header_p != NULL);
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
ecma_collection_chunk_t *chunk_p = ECMA_GET_POINTER (ecma_collection_chunk_t,
header_p->first_chunk_cp);
ecma_length_t value_index = 0;
while (chunk_p != NULL)
{
JERRY_ASSERT (value_index < header_p->unit_number);
ecma_value_t *cur_value_buf_iter_p = (ecma_value_t *) chunk_p->data;
ecma_value_t *cur_value_buf_end_p = cur_value_buf_iter_p + values_in_chunk;
while (cur_value_buf_iter_p != cur_value_buf_end_p
&& value_index < header_p->unit_number)
{
JERRY_ASSERT (cur_value_buf_iter_p < cur_value_buf_end_p);
if (do_deref_if_object)
{
ecma_free_value (*cur_value_buf_iter_p);
}
else
{
ecma_free_value_if_not_object (*cur_value_buf_iter_p);
}
cur_value_buf_iter_p++;
value_index++;
}
ecma_collection_chunk_t *next_chunk_p = ECMA_GET_POINTER (ecma_collection_chunk_t,
chunk_p->next_chunk_cp);
ecma_dealloc_collection_chunk (chunk_p);
chunk_p = next_chunk_p;
}
ecma_dealloc_collection_header (header_p);
} /* ecma_free_values_collection */
/**
* Append new value to ecma values collection
*/
void
ecma_append_to_values_collection (ecma_collection_header_t *header_p, /**< collection's header */
ecma_value_t v, /**< ecma value to append */
bool do_ref_if_object) /**< if the value is object value,
increase reference counter of the object */
{
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
size_t values_number = header_p->unit_number;
size_t pos_of_new_value_in_chunk = values_number % values_in_chunk;
values_number++;
if ((ecma_length_t) values_number == values_number)
{
header_p->unit_number = (ecma_length_t) values_number;
}
else
{
jerry_fatal (ERR_OUT_OF_MEMORY);
}
ecma_collection_chunk_t *chunk_p = ECMA_GET_POINTER (ecma_collection_chunk_t,
header_p->last_chunk_cp);
if (pos_of_new_value_in_chunk == 0)
{
/* all chunks are currently filled with values */
chunk_p = ecma_alloc_collection_chunk ();
chunk_p->next_chunk_cp = ECMA_NULL_POINTER;
if (header_p->last_chunk_cp == ECMA_NULL_POINTER)
{
JERRY_ASSERT (header_p->first_chunk_cp == ECMA_NULL_POINTER);
ECMA_SET_NON_NULL_POINTER (header_p->first_chunk_cp, chunk_p);
}
else
{
ecma_collection_chunk_t *last_chunk_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_chunk_t,
header_p->last_chunk_cp);
JERRY_ASSERT (last_chunk_p->next_chunk_cp == ECMA_NULL_POINTER);
ECMA_SET_NON_NULL_POINTER (last_chunk_p->next_chunk_cp, chunk_p);
}
ECMA_SET_NON_NULL_POINTER (header_p->last_chunk_cp, chunk_p);
}
else
{
/* last chunk can be appended with the new value */
JERRY_ASSERT (chunk_p != NULL);
}
ecma_value_t *values_p = (ecma_value_t *) chunk_p->data;
JERRY_ASSERT ((uint8_t *) (values_p + pos_of_new_value_in_chunk + 1) <= (uint8_t *) (chunk_p + 1));
if (do_ref_if_object)
{
values_p[pos_of_new_value_in_chunk] = ecma_copy_value (v);
}
else
{
values_p[pos_of_new_value_in_chunk] = ecma_copy_value_if_not_object (v);
}
} /* ecma_append_to_values_collection */
/**
* Remove last element of the collection
*
* Warning:
* the function invalidates all iterators that are configured to access the passed collection
*/
void
ecma_remove_last_value_from_values_collection (ecma_collection_header_t *header_p) /**< collection's header */
{
JERRY_ASSERT (header_p != NULL && header_p->unit_number > 0);
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
size_t values_number = header_p->unit_number;
size_t pos_of_value_to_remove_in_chunk = (values_number - 1u) % values_in_chunk;
ecma_collection_chunk_t *last_chunk_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_chunk_t,
header_p->last_chunk_cp);
ecma_value_t *values_p = (ecma_value_t *) last_chunk_p->data;
JERRY_ASSERT ((uint8_t *) (values_p + pos_of_value_to_remove_in_chunk + 1) <= (uint8_t *) (last_chunk_p + 1));
ecma_value_t value_to_remove = values_p[pos_of_value_to_remove_in_chunk];
ecma_free_value (value_to_remove);
header_p->unit_number--;
if (pos_of_value_to_remove_in_chunk == 0)
{
ecma_collection_chunk_t *chunk_to_remove_p = last_chunk_p;
/* free last chunk */
if (header_p->first_chunk_cp == header_p->last_chunk_cp)
{
header_p->first_chunk_cp = ECMA_NULL_POINTER;
header_p->last_chunk_cp = ECMA_NULL_POINTER;
}
else
{
ecma_collection_chunk_t *chunk_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_chunk_t,
header_p->first_chunk_cp);
while (chunk_iter_p->next_chunk_cp != header_p->last_chunk_cp)
{
chunk_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_chunk_t,
chunk_iter_p->next_chunk_cp);
}
ecma_collection_chunk_t *new_last_chunk_p = chunk_iter_p;
JERRY_ASSERT (ECMA_GET_NON_NULL_POINTER (ecma_collection_chunk_t,
new_last_chunk_p->next_chunk_cp) == chunk_to_remove_p);
ECMA_SET_NON_NULL_POINTER (header_p->last_chunk_cp, new_last_chunk_p);
new_last_chunk_p->next_chunk_cp = ECMA_NULL_POINTER;
}
ecma_dealloc_collection_chunk (chunk_to_remove_p);
}
} /* ecma_remove_last_value_from_values_collection */
/**
* Allocate a collection of ecma-strings.
*
* @return pointer to the collection's header
*/
ecma_collection_header_t *
ecma_new_strings_collection (ecma_string_t *string_ptrs_buffer[], /**< pointers to ecma-strings */
ecma_length_t strings_number) /**< number of ecma-strings */
{
JERRY_ASSERT (string_ptrs_buffer != NULL || strings_number == 0);
ecma_collection_header_t *new_collection_p;
new_collection_p = ecma_new_values_collection (NULL, 0, false);
for (ecma_length_t string_index = 0;
string_index < strings_number;
string_index++)
{
ecma_append_to_values_collection (new_collection_p,
ecma_make_string_value (string_ptrs_buffer[string_index]),
false);
}
return new_collection_p;
} /* ecma_new_strings_collection */
/**
* Initialize new collection iterator for the collection
*/
void
ecma_collection_iterator_init (ecma_collection_iterator_t *iterator_p, /**< context of iterator */
ecma_collection_header_t *collection_p) /**< header of collection */
{
iterator_p->header_p = collection_p;
iterator_p->next_chunk_cp = (collection_p != NULL ? collection_p->first_chunk_cp : JMEM_CP_NULL);
iterator_p->current_index = 0;
iterator_p->current_value_p = NULL;
iterator_p->current_chunk_end_p = NULL;
} /* ecma_collection_iterator_init */
/**
* Move collection iterator to next element if there is any.
*
* @return true - if iterator moved,
* false - otherwise (current element is last element in the collection)
*/
bool
ecma_collection_iterator_next (ecma_collection_iterator_t *iterator_p) /**< context of iterator */
{
if (iterator_p->header_p == NULL
|| unlikely (iterator_p->header_p->unit_number == 0))
{
return false;
}
const size_t values_in_chunk = JERRY_SIZE_OF_STRUCT_MEMBER (ecma_collection_chunk_t, data) / sizeof (ecma_value_t);
if (iterator_p->current_value_p == NULL)
{
JERRY_ASSERT (iterator_p->current_index == 0);
ecma_collection_chunk_t *first_chunk_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_chunk_t,
iterator_p->header_p->first_chunk_cp);
iterator_p->next_chunk_cp = first_chunk_p->next_chunk_cp;
iterator_p->current_value_p = (ecma_value_t *) &first_chunk_p->data;
iterator_p->current_chunk_end_p = (iterator_p->current_value_p + values_in_chunk);
}
else
{
if (iterator_p->current_index + 1 == iterator_p->header_p->unit_number)
{
return false;
}
JERRY_ASSERT (iterator_p->current_index + 1 < iterator_p->header_p->unit_number);
iterator_p->current_index++;
iterator_p->current_value_p++;
}
if (iterator_p->current_value_p == iterator_p->current_chunk_end_p)
{
ecma_collection_chunk_t *next_chunk_p = ECMA_GET_POINTER (ecma_collection_chunk_t,
iterator_p->next_chunk_cp);
JERRY_ASSERT (next_chunk_p != NULL);
iterator_p->next_chunk_cp = next_chunk_p->next_chunk_cp;
iterator_p->current_value_p = (ecma_value_t *) &next_chunk_p->data;
iterator_p->current_chunk_end_p = iterator_p->current_value_p + values_in_chunk;
}
else
{
JERRY_ASSERT (iterator_p->current_value_p < iterator_p->current_chunk_end_p);
}
return true;
} /* ecma_collection_iterator_next */
/**
* @}
* @}
*/
File diff suppressed because it is too large Load Diff
+437 -254
View File
@@ -1,5 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2015-2016 University of Szeged.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +17,8 @@
#define ECMA_HELPERS_H
#include "ecma-globals.h"
#include "jmem-allocator.h"
#include "jmem.h"
#include "lit-strings.h"
/** \addtogroup ecma ECMA
@@ -33,6 +33,12 @@
*/
#define ECMA_GET_NON_NULL_POINTER(type, field) JMEM_CP_GET_NON_NULL_POINTER (type, field)
/**
* Extract value of pointer from specified pointer-tag value
*/
#define ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG(type, field) \
JMEM_CP_GET_NON_NULL_POINTER_FROM_POINTER_TAG (type, field)
/**
* Get value of pointer from specified compressed pointer.
*/
@@ -42,8 +48,15 @@
* Set value of non-null compressed pointer so that it will correspond
* to specified non_compressed_pointer.
*/
#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) JMEM_CP_SET_NON_NULL_POINTER (field, \
non_compressed_pointer)
#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) \
JMEM_CP_SET_NON_NULL_POINTER (field, non_compressed_pointer)
/**
* Set value of pointer-tag value so that it will correspond
* to specified non_compressed_pointer along with tag
*/
#define ECMA_SET_NON_NULL_POINTER_TAG(field, non_compressed_pointer, tag) \
JMEM_CP_SET_NON_NULL_POINTER_TAG (field, non_compressed_pointer, tag)
/**
* Set value of compressed pointer so that it will correspond
@@ -51,287 +64,457 @@
*/
#define ECMA_SET_POINTER(field, non_compressed_pointer) JMEM_CP_SET_POINTER (field, non_compressed_pointer)
/**
* Get value of each tag bit from specified pointer-tag value
*/
#define ECMA_GET_FIRST_BIT_FROM_POINTER_TAG(field) \
JMEM_CP_GET_FIRST_BIT_FROM_POINTER_TAG (field) /**< get first tag bit from jmem_cpointer_tag_t **/
#define ECMA_GET_SECOND_BIT_FROM_POINTER_TAG(field) \
JMEM_CP_GET_SECOND_BIT_FROM_POINTER_TAG (field) /**< get second tag bit from jmem_cpointer_tag_t **/
#define ECMA_GET_THIRD_BIT_FROM_POINTER_TAG(field) \
JMEM_CP_GET_THIRD_BIT_FROM_POINTER_TAG (field) /**< get third tag bit from jmem_cpointer_tag_t **/
/**
* Set value of each tag bit to specified pointer-tag value
*/
#define ECMA_SET_FIRST_BIT_TO_POINTER_TAG(field) \
JMEM_CP_SET_FIRST_BIT_TO_POINTER_TAG (field) /**< set first tag bit to jmem_cpointer_tag_t **/
#define ECMA_SET_SECOND_BIT_TO_POINTER_TAG(field) \
JMEM_CP_SET_SECOND_BIT_TO_POINTER_TAG (field) /**< set second tag bit to jmem_cpointer_tag_t **/
#define ECMA_SET_THIRD_BIT_TO_POINTER_TAG(field) \
JMEM_CP_SET_THIRD_BIT_TO_POINTER_TAG (field) /**< set third tag bit to jmem_cpointer_tag_t **/
/**
* Status flags for ecma_string_get_chars function
*/
typedef enum
{
ECMA_STRING_FLAG_EMPTY = 0, /**< No options are provided. */
ECMA_STRING_FLAG_IS_ASCII = (1 << 0), /**< The string contains only ASCII characters. */
ECMA_STRING_FLAG_REHASH_NEEDED = (1 << 1), /**< The hash of the string must be recalculated.
* For more details see ecma_append_chars_to_string */
ECMA_STRING_FLAG_IS_UINT32 = (1 << 2), /**< The string repesents an UINT32 number */
ECMA_STRING_FLAG_MUST_BE_FREED = (1 << 3), /**< The returned buffer must be freed */
} ecma_string_flag_t;
/**
* Underscore is ignored when this option is passed.
*/
#define ECMA_CONVERSION_ALLOW_UNDERSCORE 0x1
/**
* Convert ecma-string's contents to a cesu-8 string and put it into a buffer.
*/
#define ECMA_STRING_TO_UTF8_STRING(ecma_str_ptr, /**< ecma string pointer */ \
utf8_ptr, /**< [out] output buffer pointer */ \
#define ECMA_STRING_TO_UTF8_STRING(ecma_str_ptr, /**< ecma string pointer */ \
utf8_ptr, /**< [out] output buffer pointer */ \
utf8_str_size) /**< [out] output buffer size */ \
lit_utf8_size_t utf8_str_size; \
bool utf8_ptr ## must_be_freed; \
const lit_utf8_byte_t *utf8_ptr = ecma_string_raw_chars (ecma_str_ptr, &utf8_str_size, &utf8_ptr ## must_be_freed); \
utf8_ptr ## must_be_freed = false; /* it was used as 'is_ascii' in 'ecma_string_raw_chars', so we must reset it */ \
\
if (utf8_ptr == NULL) \
{ \
utf8_ptr = (const lit_utf8_byte_t *) jmem_heap_alloc_block (utf8_str_size); \
ecma_string_to_utf8_bytes (ecma_str_ptr, (lit_utf8_byte_t *) utf8_ptr, utf8_str_size); \
utf8_ptr ## must_be_freed = true; \
}
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
/**
* Set an internal property value of pointer
*/
#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) \
(field) = ((ecma_value_t) pointer)
/**
* Get an internal property value of pointer
*/
#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \
((type *) field)
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
/**
* Set an internal property value of non-null pointer so that it will correspond
* to specified non_compressed_pointer.
*/
#define ECMA_SET_INTERNAL_VALUE_POINTER(field, non_compressed_pointer) \
ECMA_SET_NON_NULL_POINTER (field, non_compressed_pointer)
/**
* Get an internal property value of pointer from specified compressed pointer.
*/
#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \
ECMA_GET_POINTER (type, field)
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
lit_utf8_size_t utf8_str_size; \
uint8_t utf8_ptr##flags = ECMA_STRING_FLAG_EMPTY; \
const lit_utf8_byte_t *utf8_ptr = ecma_string_get_chars (ecma_str_ptr, &utf8_str_size, NULL, NULL, &utf8_ptr##flags);
/**
* Free the cesu-8 string buffer allocated by 'ECMA_STRING_TO_UTF8_STRING'
*/
#define ECMA_FINALIZE_UTF8_STRING(utf8_ptr, /**< pointer to character buffer */ \
utf8_str_size) /**< buffer size */ \
if (utf8_ptr ## must_be_freed) \
{ \
JERRY_ASSERT (utf8_ptr != NULL); \
jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
utf8_str_size) /**< buffer size */ \
if (utf8_ptr##flags & ECMA_STRING_FLAG_MUST_BE_FREED) \
{ \
JERRY_ASSERT (utf8_ptr != NULL); \
jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
}
/* ecma-helpers-value.c */
extern bool ecma_is_value_direct (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_simple (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_empty (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_undefined (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_null (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_boolean (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_true (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_false (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_array_hole (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_integer_number (ecma_value_t) __attr_pure___;
extern bool ecma_are_values_integer_numbers (ecma_value_t, ecma_value_t) __attr_pure___;
extern bool ecma_is_value_float_number (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_number (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_string (ecma_value_t) __attr_pure___;
extern bool ecma_is_value_object (ecma_value_t) __attr_pure___;
extern void ecma_check_value_type_is_spec_defined (ecma_value_t);
extern ecma_value_t ecma_make_simple_value (const ecma_simple_value_t value) __attr_const___;
extern ecma_value_t ecma_make_boolean_value (bool) __attr_const___;
extern ecma_value_t ecma_make_integer_value (ecma_integer_value_t) __attr_const___;
extern ecma_value_t ecma_make_nan_value (void);
extern ecma_value_t ecma_make_number_value (ecma_number_t);
extern ecma_value_t ecma_make_int32_value (int32_t);
extern ecma_value_t ecma_make_uint32_value (uint32_t);
extern ecma_value_t ecma_make_string_value (const ecma_string_t *);
extern ecma_value_t ecma_make_object_value (const ecma_object_t *);
extern ecma_value_t ecma_make_error_value (ecma_value_t);
extern ecma_value_t ecma_make_error_obj_value (const ecma_object_t *);
extern ecma_integer_value_t ecma_get_integer_from_value (ecma_value_t) __attr_pure___;
extern ecma_number_t ecma_get_float_from_value (ecma_value_t) __attr_pure___;
extern ecma_number_t ecma_get_number_from_value (ecma_value_t) __attr_pure___;
extern uint32_t ecma_get_uint32_from_value (ecma_value_t) __attr_pure___;
extern ecma_string_t *ecma_get_string_from_value (ecma_value_t) __attr_pure___;
extern ecma_object_t *ecma_get_object_from_value (ecma_value_t) __attr_pure___;
extern ecma_value_t ecma_get_value_from_error_value (ecma_value_t) __attr_pure___;
extern ecma_value_t ecma_invert_boolean_value (ecma_value_t) __attr_pure___;
extern ecma_value_t ecma_copy_value (ecma_value_t);
extern ecma_value_t ecma_fast_copy_value (ecma_value_t);
extern ecma_value_t ecma_copy_value_if_not_object (ecma_value_t);
extern ecma_value_t ecma_update_float_number (ecma_value_t, ecma_number_t);
extern void ecma_value_assign_value (ecma_value_t *, ecma_value_t);
extern void ecma_value_assign_number (ecma_value_t *, ecma_number_t);
extern void ecma_value_assign_uint32 (ecma_value_t *, uint32_t);
extern void ecma_free_value (ecma_value_t);
extern void ecma_fast_free_value (ecma_value_t);
extern void ecma_free_value_if_not_object (ecma_value_t);
/* ecma-helpers-string.c */
extern ecma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *, lit_utf8_size_t);
extern ecma_string_t *ecma_new_ecma_string_from_code_unit (ecma_char_t);
extern ecma_string_t *ecma_new_ecma_string_from_uint32 (uint32_t);
extern ecma_string_t *ecma_new_ecma_string_from_number (ecma_number_t);
extern ecma_string_t *ecma_new_ecma_string_from_magic_string_id (lit_magic_string_id_t);
extern ecma_string_t *ecma_new_ecma_string_from_magic_string_ex_id (lit_magic_string_ex_id_t);
extern ecma_string_t *ecma_new_ecma_length_string ();
extern ecma_string_t *ecma_concat_ecma_strings (ecma_string_t *, ecma_string_t *);
extern void ecma_ref_ecma_string (ecma_string_t *);
extern void ecma_deref_ecma_string (ecma_string_t *);
extern ecma_number_t ecma_string_to_number (const ecma_string_t *);
extern bool ecma_string_get_array_index (const ecma_string_t *, uint32_t *);
extern lit_utf8_size_t __attr_return_value_should_be_checked___
ecma_string_copy_to_utf8_buffer (const ecma_string_t *, lit_utf8_byte_t *, lit_utf8_size_t);
extern void ecma_string_to_utf8_bytes (const ecma_string_t *, lit_utf8_byte_t *, lit_utf8_size_t);
extern const lit_utf8_byte_t *ecma_string_raw_chars (const ecma_string_t *, lit_utf8_size_t *, bool *);
extern void ecma_init_ecma_string_from_uint32 (ecma_string_t *, uint32_t);
extern void ecma_init_ecma_length_string (ecma_string_t *);
extern bool ecma_string_is_empty (const ecma_string_t *);
extern bool ecma_string_is_length (const ecma_string_t *);
extern bool ecma_compare_ecma_strings_equal_hashes (const ecma_string_t *, const ecma_string_t *);
extern bool ecma_compare_ecma_strings (const ecma_string_t *, const ecma_string_t *);
extern bool ecma_compare_ecma_strings_relational (const ecma_string_t *, const ecma_string_t *);
extern ecma_length_t ecma_string_get_length (const ecma_string_t *);
extern lit_utf8_size_t ecma_string_get_size (const ecma_string_t *);
extern ecma_char_t ecma_string_get_char_at_pos (const ecma_string_t *, ecma_length_t);
extern ecma_string_t *ecma_get_magic_string (lit_magic_string_id_t);
extern ecma_string_t *ecma_get_magic_string_ex (lit_magic_string_ex_id_t);
extern bool ecma_is_string_magic (const ecma_string_t *, lit_magic_string_id_t *);
extern lit_string_hash_t ecma_string_hash (const ecma_string_t *);
extern ecma_string_t *ecma_string_substr (const ecma_string_t *, ecma_length_t, ecma_length_t);
extern ecma_string_t *ecma_string_trim (const ecma_string_t *);
/* ecma-helpers-number.c */
extern ecma_number_t ecma_number_make_nan (void);
extern ecma_number_t ecma_number_make_infinity (bool);
extern bool ecma_number_is_nan (ecma_number_t);
extern bool ecma_number_is_negative (ecma_number_t);
extern bool ecma_number_is_zero (ecma_number_t);
extern bool ecma_number_is_infinity (ecma_number_t);
extern int32_t
ecma_number_get_fraction_and_exponent (ecma_number_t, uint64_t *, int32_t *);
extern ecma_number_t
ecma_number_make_normal_positive_from_fraction_and_exponent (uint64_t, int32_t);
extern ecma_number_t
ecma_number_make_from_sign_mantissa_and_exponent (bool, uint64_t, int32_t);
extern ecma_number_t ecma_number_get_prev (ecma_number_t);
extern ecma_number_t ecma_number_get_next (ecma_number_t);
extern ecma_number_t ecma_number_negate (ecma_number_t);
extern ecma_number_t ecma_number_trunc (ecma_number_t);
extern ecma_number_t ecma_number_calc_remainder (ecma_number_t, ecma_number_t);
extern ecma_number_t ecma_number_add (ecma_number_t, ecma_number_t);
extern ecma_number_t ecma_number_substract (ecma_number_t, ecma_number_t);
extern ecma_number_t ecma_number_multiply (ecma_number_t, ecma_number_t);
extern ecma_number_t ecma_number_divide (ecma_number_t, ecma_number_t);
extern lit_utf8_size_t ecma_number_to_decimal (ecma_number_t, lit_utf8_byte_t *, int32_t *);
/* ecma-helpers-values-collection.c */
extern ecma_collection_header_t *ecma_new_values_collection (const ecma_value_t[], ecma_length_t, bool);
extern void ecma_free_values_collection (ecma_collection_header_t *, bool);
extern void ecma_append_to_values_collection (ecma_collection_header_t *, ecma_value_t, bool);
extern void ecma_remove_last_value_from_values_collection (ecma_collection_header_t *);
extern ecma_collection_header_t *ecma_new_strings_collection (ecma_string_t *[], ecma_length_t);
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
/**
* Context of ecma values' collection iterator
* Set an internal property value from pointer.
*/
typedef struct
{
ecma_collection_header_t *header_p; /**< collection header */
jmem_cpointer_t next_chunk_cp; /**< compressed pointer to next chunk */
ecma_length_t current_index; /**< index of current element */
const ecma_value_t *current_value_p; /**< pointer to current element */
const ecma_value_t *current_chunk_beg_p; /**< pointer to beginning of current chunk's data */
const ecma_value_t *current_chunk_end_p; /**< pointer to place right after the end of current chunk's data */
} ecma_collection_iterator_t;
#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) ((field) = ((ecma_value_t) pointer))
extern void
ecma_collection_iterator_init (ecma_collection_iterator_t *, ecma_collection_header_t *);
extern bool
ecma_collection_iterator_next (ecma_collection_iterator_t *);
/**
* Set an internal property value from pointer. Pointer can be NULL.
*/
#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) ((field) = ((ecma_value_t) pointer))
/**
* Convert an internal property value to pointer.
*/
#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) ((type *) field)
/**
* Convert an internal property value to pointer. Result can be NULL.
*/
#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) ((type *) field)
/**
* Checks whether an internal property is NULL.
*/
#define ECMA_IS_INTERNAL_VALUE_NULL(field) ((field) == ((ecma_value_t) NULL))
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
/**
* Set an internal property value from pointer.
*/
#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) ECMA_SET_NON_NULL_POINTER (field, pointer)
/**
* Set an internal property value from pointer. Pointer can be NULL.
*/
#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) ECMA_SET_POINTER (field, pointer)
/**
* Convert an internal property value to pointer.
*/
#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) ECMA_GET_NON_NULL_POINTER (type, field)
/**
* Convert an internal property value to pointer. Result can be NULL.
*/
#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) ECMA_GET_POINTER (type, field)
/**
* Checks whether an internal property is NULL.
*/
#define ECMA_IS_INTERNAL_VALUE_NULL(field) ((field) == ((ecma_value_t) JMEM_CP_NULL))
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
/**
* Convert boolean to bitfield value.
*/
#define ECMA_BOOL_TO_BITFIELD(x) ((x) ? 1 : 0)
/**
* Check whether the given type is ECMA_OBJECT_TYPE_PROXY
*
* @param type object type
*/
#define ECMA_OBJECT_TYPE_IS_PROXY(type) (JERRY_UNLIKELY ((type) == ECMA_OBJECT_TYPE_PROXY))
/**
* Check whether the given object has [[ProxyHandler]] and [[ProxyTarger]] internal slots
*
* @param obj_p ecma-object
*/
#if JERRY_BUILTIN_PROXY
#define ECMA_OBJECT_IS_PROXY(obj_p) (ECMA_OBJECT_TYPE_IS_PROXY (ecma_get_object_type ((obj_p))))
#else /* !JERRY_BUILTIN_PROXY */
#define ECMA_OBJECT_IS_PROXY(obj_p) (false)
#endif /* JERRY_BUILTIN_PROXY */
/* ecma-helpers-value.c */
ecma_type_t JERRY_ATTR_CONST ecma_get_value_type_field (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_direct (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_simple (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_empty (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_undefined (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_null (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_boolean (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_true (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_false (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_found (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_array_hole (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_integer_number (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_are_values_integer_numbers (ecma_value_t first_value, ecma_value_t second_value);
bool JERRY_ATTR_CONST ecma_is_value_float_number (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_number (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_string (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_symbol (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_magic_string (ecma_value_t value, lit_magic_string_id_t id);
bool JERRY_ATTR_CONST ecma_is_value_bigint (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_prop_name (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_direct_string (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_non_direct_string (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_object (ecma_value_t value);
bool JERRY_ATTR_CONST ecma_is_value_exception (ecma_value_t value);
ecma_value_t ecma_is_value_array (ecma_value_t arg);
void ecma_check_value_type_is_spec_defined (ecma_value_t value);
ecma_value_t JERRY_ATTR_CONST ecma_make_boolean_value (bool boolean_value);
ecma_value_t JERRY_ATTR_CONST ecma_make_integer_value (ecma_integer_value_t integer_value);
ecma_value_t ecma_make_nan_value (void);
ecma_value_t ecma_make_float_value (ecma_number_t *ecma_num_p);
ecma_value_t ecma_make_length_value (ecma_length_t length);
ecma_value_t ecma_make_number_value (ecma_number_t ecma_number);
ecma_value_t ecma_make_int32_value (int32_t int32_number);
ecma_value_t ecma_make_uint32_value (uint32_t uint32_number);
ecma_value_t JERRY_ATTR_PURE ecma_make_string_value (const ecma_string_t *ecma_string_p);
ecma_value_t JERRY_ATTR_PURE ecma_make_symbol_value (const ecma_string_t *ecma_symbol_p);
ecma_value_t JERRY_ATTR_PURE ecma_make_prop_name_value (const ecma_string_t *ecma_prop_name_p);
ecma_value_t JERRY_ATTR_PURE ecma_make_magic_string_value (lit_magic_string_id_t id);
ecma_value_t JERRY_ATTR_PURE ecma_make_object_value (const ecma_object_t *object_p);
ecma_value_t JERRY_ATTR_PURE ecma_make_extended_primitive_value (const ecma_extended_primitive_t *primitve_p,
uint32_t type);
ecma_integer_value_t JERRY_ATTR_CONST ecma_get_integer_from_value (ecma_value_t value);
ecma_number_t JERRY_ATTR_PURE ecma_get_float_from_value (ecma_value_t value);
ecma_number_t *ecma_get_pointer_from_float_value (ecma_value_t value);
ecma_number_t JERRY_ATTR_PURE ecma_get_number_from_value (ecma_value_t value);
ecma_string_t JERRY_ATTR_PURE *ecma_get_string_from_value (ecma_value_t value);
ecma_string_t JERRY_ATTR_PURE *ecma_get_symbol_from_value (ecma_value_t value);
ecma_string_t JERRY_ATTR_PURE *ecma_get_prop_name_from_value (ecma_value_t value);
ecma_object_t JERRY_ATTR_PURE *ecma_get_object_from_value (ecma_value_t value);
ecma_extended_primitive_t JERRY_ATTR_PURE *ecma_get_extended_primitive_from_value (ecma_value_t value);
ecma_value_t JERRY_ATTR_CONST ecma_invert_boolean_value (ecma_value_t value);
ecma_value_t ecma_copy_value (ecma_value_t value);
ecma_value_t ecma_fast_copy_value (ecma_value_t value);
ecma_value_t ecma_copy_value_if_not_object (ecma_value_t value);
void ecma_ref_if_object (ecma_value_t value);
void ecma_deref_if_object (ecma_value_t value);
ecma_value_t ecma_update_float_number (ecma_value_t float_value, ecma_number_t new_number);
void ecma_value_assign_value (ecma_value_t *value_p, ecma_value_t ecma_value);
void ecma_value_assign_number (ecma_value_t *value_p, ecma_number_t ecma_number);
void ecma_free_value (ecma_value_t value);
void ecma_fast_free_value (ecma_value_t value);
void ecma_free_value_if_not_object (ecma_value_t value);
void ecma_free_object (ecma_value_t value);
void ecma_free_number (ecma_value_t value);
lit_magic_string_id_t ecma_get_typeof_lit_id (ecma_value_t value);
/* ecma-helpers-string.c */
ecma_string_t *ecma_new_symbol_from_descriptor_string (ecma_value_t string_desc);
bool ecma_prop_name_is_symbol (ecma_string_t *string_p);
ecma_length_t ecma_op_advance_string_index (ecma_string_t *str_p, ecma_length_t index_num, bool is_unicode);
#if JERRY_BUILTIN_CONTAINER
ecma_string_t *ecma_new_map_key_string (ecma_value_t value);
bool ecma_prop_name_is_map_key (ecma_string_t *string_p);
#endif /* JERRY_BUILTIN_CONTAINER */
ecma_string_t *ecma_new_ecma_string_from_ascii (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);
ecma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);
ecma_string_t *ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string_p,
lit_utf8_size_t string_size);
ecma_string_t *
ecma_new_ecma_external_string_from_cesu8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size, void *user_p);
ecma_string_t *ecma_new_ecma_string_from_code_unit (ecma_char_t code_unit);
ecma_string_t *ecma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, ecma_char_t second_code_unit);
ecma_string_t *ecma_new_ecma_string_from_length (ecma_length_t index);
ecma_string_t *ecma_new_ecma_string_from_uint32 (uint32_t uint32_number);
ecma_string_t *ecma_new_non_direct_string_from_uint32 (uint32_t uint32_number);
ecma_string_t *ecma_get_ecma_string_from_uint32 (uint32_t uint32_number);
ecma_string_t *ecma_new_ecma_string_from_number (ecma_number_t num);
ecma_string_t *ecma_get_magic_string (lit_magic_string_id_t id);
ecma_string_t *ecma_get_internal_string (lit_magic_string_id_t id);
ecma_string_t *ecma_append_chars_to_string (ecma_string_t *string1_p,
const lit_utf8_byte_t *cesu8_string2_p,
lit_utf8_size_t cesu8_string2_size,
lit_utf8_size_t cesu8_string2_length);
ecma_string_t *ecma_concat_ecma_strings (ecma_string_t *string1_p, ecma_string_t *string2_p);
void ecma_ref_ecma_string (ecma_string_t *string_p);
void ecma_ref_ecma_string_non_direct (ecma_string_t *string_p);
void ecma_deref_ecma_string (ecma_string_t *string_p);
void ecma_deref_ecma_string_non_direct (ecma_string_t *string_p);
void ecma_destroy_ecma_string (ecma_string_t *string_p);
ecma_number_t ecma_string_to_number (const ecma_string_t *str_p);
uint32_t ecma_string_get_array_index (const ecma_string_t *str_p);
lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT ecma_string_copy_to_buffer (const ecma_string_t *string_desc_p,
lit_utf8_byte_t *buffer_p,
lit_utf8_size_t buffer_size,
jerry_encoding_t encoding);
void
ecma_string_to_cesu8_bytes (const ecma_string_t *string_desc_p, lit_utf8_byte_t *buffer_p, lit_utf8_size_t buffer_size);
const lit_utf8_byte_t *ecma_string_get_chars (const ecma_string_t *string_p,
lit_utf8_size_t *size_p,
lit_utf8_size_t *length_p,
lit_utf8_byte_t *uint32_buff_p,
uint8_t *flags_p);
bool ecma_compare_ecma_string_to_magic_id (const ecma_string_t *string_p, lit_magic_string_id_t id);
bool ecma_string_is_empty (const ecma_string_t *string_p);
bool ecma_string_is_length (const ecma_string_t *string_p);
jmem_cpointer_t ecma_string_to_property_name (ecma_string_t *prop_name_p, ecma_property_t *name_type_p);
ecma_string_t *ecma_string_from_property_name (ecma_property_t property, jmem_cpointer_t prop_name_cp);
lit_string_hash_t ecma_string_get_property_name_hash (ecma_property_t property, jmem_cpointer_t prop_name_cp);
uint32_t ecma_string_get_property_index (ecma_property_t property, jmem_cpointer_t prop_name_cp);
bool ecma_string_compare_to_property_name (ecma_property_t property,
jmem_cpointer_t prop_name_cp,
const ecma_string_t *string_p);
bool ecma_compare_ecma_strings (const ecma_string_t *string1_p, const ecma_string_t *string2_p);
bool ecma_compare_ecma_non_direct_strings (const ecma_string_t *string1_p, const ecma_string_t *string2_p);
bool ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, const ecma_string_t *string2_p);
lit_utf8_size_t ecma_string_get_length (const ecma_string_t *string_p);
lit_utf8_size_t ecma_string_get_utf8_length (const ecma_string_t *string_p);
lit_utf8_size_t ecma_string_get_size (const ecma_string_t *string_p);
lit_utf8_size_t ecma_string_get_utf8_size (const ecma_string_t *string_p);
ecma_char_t ecma_string_get_char_at_pos (const ecma_string_t *string_p, lit_utf8_size_t index);
lit_magic_string_id_t ecma_get_string_magic (const ecma_string_t *string_p);
lit_string_hash_t ecma_string_hash (const ecma_string_t *string_p);
ecma_string_t *ecma_string_substr (const ecma_string_t *string_p, lit_utf8_size_t start_pos, lit_utf8_size_t end_pos);
const lit_utf8_byte_t *ecma_string_trim_front (const lit_utf8_byte_t *start_p, const lit_utf8_byte_t *end_p);
const lit_utf8_byte_t *ecma_string_trim_back (const lit_utf8_byte_t *start_p, const lit_utf8_byte_t *end_p);
void ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p, lit_utf8_size_t *utf8_str_size);
ecma_string_t *ecma_string_trim (const ecma_string_t *string_p);
ecma_value_t
ecma_string_pad (ecma_value_t original_string_p, ecma_value_t max_length, ecma_value_t fill_string, bool pad_on_start);
ecma_stringbuilder_t ecma_stringbuilder_create (void);
ecma_stringbuilder_t ecma_stringbuilder_create_from (ecma_string_t *string_p);
ecma_stringbuilder_t ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, const lit_utf8_size_t data_size);
lit_utf8_size_t ecma_stringbuilder_get_size (ecma_stringbuilder_t *builder_p);
lit_utf8_byte_t *ecma_stringbuilder_get_data (ecma_stringbuilder_t *builder_p);
void ecma_stringbuilder_revert (ecma_stringbuilder_t *builder_p, const lit_utf8_size_t size);
void ecma_stringbuilder_append (ecma_stringbuilder_t *builder_p, const ecma_string_t *string_p);
void ecma_stringbuilder_append_magic (ecma_stringbuilder_t *builder_p, const lit_magic_string_id_t id);
void ecma_stringbuilder_append_raw (ecma_stringbuilder_t *builder_p,
const lit_utf8_byte_t *data_p,
const lit_utf8_size_t data_size);
void ecma_stringbuilder_append_codepoint (ecma_stringbuilder_t *builder_p, lit_code_point_t cp);
void ecma_stringbuilder_append_char (ecma_stringbuilder_t *builder_p, const ecma_char_t c);
void ecma_stringbuilder_append_byte (ecma_stringbuilder_t *builder_p, const lit_utf8_byte_t);
ecma_string_t *ecma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p);
void ecma_stringbuilder_destroy (ecma_stringbuilder_t *builder_p);
/* ecma-helpers-number.c */
ecma_number_t ecma_number_make_nan (void);
ecma_number_t ecma_number_make_infinity (bool sign);
bool ecma_number_is_nan (ecma_number_t num);
bool ecma_number_is_negative (ecma_number_t num);
bool ecma_number_is_zero (ecma_number_t num);
bool ecma_number_is_infinity (ecma_number_t num);
bool ecma_number_is_finite (ecma_number_t num);
ecma_number_t ecma_number_get_prev (ecma_number_t num);
ecma_number_t ecma_number_get_next (ecma_number_t num);
ecma_number_t ecma_number_trunc (ecma_number_t num);
ecma_number_t ecma_number_remainder (ecma_number_t left_num, ecma_number_t right_num);
ecma_number_t ecma_number_pow (ecma_number_t x, ecma_number_t y);
ecma_value_t
ecma_number_parse_int (const lit_utf8_byte_t *string_buff, lit_utf8_size_t string_buff_size, ecma_value_t radix);
ecma_value_t ecma_number_parse_float (const lit_utf8_byte_t *string_buff, lit_utf8_size_t string_buff_size);
ecma_value_t ecma_integer_multiply (ecma_integer_value_t left_integer, ecma_integer_value_t right_integer);
lit_utf8_size_t ecma_number_to_decimal (ecma_number_t num, lit_utf8_byte_t *out_digits_p, int32_t *out_decimal_exp_p);
/* ecma-helpers-collection.c */
ecma_collection_t *ecma_new_collection (void);
void ecma_collection_push_back (ecma_collection_t *collection_p, ecma_value_t value);
void ecma_collection_reserve (ecma_collection_t *collection_p, uint32_t count);
void ecma_collection_append (ecma_collection_t *collection_p, const ecma_value_t *buffer_p, uint32_t count);
void ecma_collection_destroy (ecma_collection_t *collection_p);
void ecma_collection_free (ecma_collection_t *collection_p);
void ecma_collection_free_if_not_object (ecma_collection_t *collection_p);
void ecma_collection_free_objects (ecma_collection_t *collection_p);
void ecma_collection_free_template_literal (ecma_collection_t *collection_p);
bool ecma_collection_check_duplicated_entries (ecma_collection_t *collection_p);
bool ecma_collection_has_string_value (ecma_collection_t *collection_p, ecma_string_t *string_p);
ecma_value_t *ecma_new_compact_collection (void);
ecma_value_t *ecma_compact_collection_push_back (ecma_value_t *compact_collection_p, ecma_value_t value);
ecma_value_t *ecma_compact_collection_shrink (ecma_value_t *compact_collection_p);
void ecma_compact_collection_free (ecma_value_t *compact_collection_p);
ecma_value_t *ecma_compact_collection_end (ecma_value_t *compact_collection_p);
void ecma_compact_collection_destroy (ecma_value_t *compact_collection_p);
/* ecma-helpers.c */
extern ecma_object_t *ecma_create_object (ecma_object_t *, bool, bool, ecma_object_type_t);
extern ecma_object_t *ecma_create_decl_lex_env (ecma_object_t *);
extern ecma_object_t *ecma_create_object_lex_env (ecma_object_t *, ecma_object_t *, bool);
extern bool ecma_is_lexical_environment (const ecma_object_t *) __attr_pure___;
extern bool ecma_get_object_extensible (const ecma_object_t *) __attr_pure___;
extern void ecma_set_object_extensible (ecma_object_t *, bool);
extern ecma_object_type_t ecma_get_object_type (const ecma_object_t *) __attr_pure___;
extern void ecma_set_object_type (ecma_object_t *, ecma_object_type_t);
extern ecma_object_t *ecma_get_object_prototype (const ecma_object_t *) __attr_pure___;
extern bool ecma_get_object_is_builtin (const ecma_object_t *) __attr_pure___;
extern void ecma_set_object_is_builtin (ecma_object_t *);
extern ecma_lexical_environment_type_t ecma_get_lex_env_type (const ecma_object_t *) __attr_pure___;
extern ecma_object_t *ecma_get_lex_env_outer_reference (const ecma_object_t *) __attr_pure___;
extern ecma_property_header_t *ecma_get_property_list (const ecma_object_t *) __attr_pure___;
extern ecma_object_t *ecma_get_lex_env_binding_object (const ecma_object_t *) __attr_pure___;
extern bool ecma_get_lex_env_provide_this (const ecma_object_t *) __attr_pure___;
ecma_object_t *ecma_create_object (ecma_object_t *prototype_object_p, size_t ext_object_size, ecma_object_type_t type);
ecma_object_t *ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p);
ecma_object_t *ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, ecma_object_t *binding_obj_p);
ecma_object_t *ecma_create_lex_env_class (ecma_object_t *outer_lexical_environment_p, size_t lexical_env_size);
bool JERRY_ATTR_PURE ecma_is_lexical_environment (const ecma_object_t *object_p);
void ecma_op_ordinary_object_set_extensible (ecma_object_t *object_p);
ecma_object_type_t JERRY_ATTR_PURE ecma_get_object_type (const ecma_object_t *object_p);
ecma_object_base_type_t JERRY_ATTR_PURE ecma_get_object_base_type (const ecma_object_t *object_p);
bool JERRY_ATTR_PURE ecma_object_class_is (ecma_object_t *object_p, ecma_object_class_type_t class_id);
ecma_lexical_environment_type_t JERRY_ATTR_PURE ecma_get_lex_env_type (const ecma_object_t *object_p);
ecma_object_t JERRY_ATTR_PURE *ecma_get_lex_env_binding_object (const ecma_object_t *object_p);
ecma_object_t *ecma_clone_decl_lexical_environment (ecma_object_t *lex_env_p, bool copy_values);
extern ecma_property_t *ecma_create_internal_property (ecma_object_t *, ecma_internal_property_id_t);
extern ecma_property_t *ecma_find_internal_property (ecma_object_t *, ecma_internal_property_id_t);
extern ecma_property_t *ecma_get_internal_property (ecma_object_t *, ecma_internal_property_id_t);
ecma_property_value_t *ecma_create_named_data_property (ecma_object_t *object_p,
ecma_string_t *name_p,
uint8_t prop_attributes,
ecma_property_t **out_prop_p);
ecma_property_value_t *ecma_create_named_accessor_property (ecma_object_t *object_p,
ecma_string_t *name_p,
ecma_object_t *get_p,
ecma_object_t *set_p,
uint8_t prop_attributes,
ecma_property_t **out_prop_p);
#if JERRY_MODULE_SYSTEM
void ecma_create_named_reference_property (ecma_object_t *object_p, ecma_string_t *name_p, ecma_value_t reference);
#endif /* JERRY_MODULE_SYSTEM */
ecma_property_t *ecma_find_named_property (ecma_object_t *obj_p, ecma_string_t *name_p);
ecma_property_value_t *ecma_get_named_data_property (ecma_object_t *obj_p, ecma_string_t *name_p);
extern ecma_property_t *
ecma_create_named_data_property (ecma_object_t *, ecma_string_t *, uint8_t);
extern ecma_property_t *
ecma_create_named_accessor_property (ecma_object_t *, ecma_string_t *, ecma_object_t *, ecma_object_t *, uint8_t);
extern ecma_property_t *
ecma_find_named_property (ecma_object_t *, ecma_string_t *);
extern ecma_property_t *
ecma_get_named_property (ecma_object_t *, ecma_string_t *);
extern ecma_property_t *
ecma_get_named_data_property (ecma_object_t *, ecma_string_t *);
void ecma_delete_property (ecma_object_t *object_p, ecma_property_value_t *prop_value_p);
extern void ecma_free_property (ecma_object_t *, ecma_string_t *, ecma_property_t *);
void
ecma_named_data_property_assign_value (ecma_object_t *obj_p, ecma_property_value_t *prop_value_p, ecma_value_t value);
extern void ecma_delete_property (ecma_object_t *, ecma_property_t *);
ecma_getter_setter_pointers_t *ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p);
void ecma_set_named_accessor_property_getter (ecma_object_t *object_p,
ecma_property_value_t *prop_value_p,
ecma_object_t *getter_p);
void ecma_set_named_accessor_property_setter (ecma_object_t *object_p,
ecma_property_value_t *prop_value_p,
ecma_object_t *setter_p);
#if JERRY_MODULE_SYSTEM
ecma_value_t ecma_property_to_reference (ecma_property_t *property_p);
ecma_property_value_t *ecma_get_property_value_from_named_reference (ecma_property_value_t *reference_p);
#endif /* JERRY_MODULE_SYSTEM */
bool ecma_is_property_writable (ecma_property_t property);
void ecma_set_property_writable_attr (ecma_property_t *property_p, bool is_writable);
bool ecma_is_property_enumerable (ecma_property_t property);
void ecma_set_property_enumerable_attr (ecma_property_t *property_p, bool is_enumerable);
bool ecma_is_property_configurable (ecma_property_t property);
void ecma_set_property_configurable_attr (ecma_property_t *property_p, bool is_configurable);
extern ecma_value_t ecma_get_named_data_property_value (const ecma_property_t *);
extern void ecma_set_named_data_property_value (ecma_property_t *, ecma_value_t);
extern void ecma_named_data_property_assign_value (ecma_object_t *, ecma_property_t *, ecma_value_t);
#if JERRY_LCACHE
bool ecma_is_property_lcached (ecma_property_t *property_p);
void ecma_set_property_lcached (ecma_property_t *property_p, bool is_lcached);
#endif /* JERRY_LCACHE */
extern ecma_value_t ecma_get_internal_property_value (const ecma_property_t *);
extern void ecma_set_internal_property_value (ecma_property_t *, ecma_value_t);
ecma_property_descriptor_t ecma_make_empty_property_descriptor (void);
void ecma_free_property_descriptor (ecma_property_descriptor_t *prop_desc_p);
extern ecma_object_t *ecma_get_named_accessor_property_getter (const ecma_property_t *);
extern ecma_object_t *ecma_get_named_accessor_property_setter (const ecma_property_t *);
extern void ecma_set_named_accessor_property_getter (ecma_object_t *, ecma_property_t *, ecma_object_t *);
extern void ecma_set_named_accessor_property_setter (ecma_object_t *, ecma_property_t *, ecma_object_t *);
extern bool ecma_is_property_writable (ecma_property_t *);
extern void ecma_set_property_writable_attr (ecma_property_t *, bool);
extern bool ecma_is_property_enumerable (ecma_property_t *);
extern void ecma_set_property_enumerable_attr (ecma_property_t *, bool);
extern bool ecma_is_property_configurable (ecma_property_t *);
extern void ecma_set_property_configurable_attr (ecma_property_t *, bool);
void ecma_ref_extended_primitive (ecma_extended_primitive_t *primitve_p);
void ecma_deref_exception (ecma_extended_primitive_t *exception_p);
#if JERRY_BUILTIN_BIGINT
void ecma_deref_bigint (ecma_extended_primitive_t *bigint_p);
#endif /* JERRY_BUILTIN_BIGINT */
extern bool ecma_is_property_lcached (ecma_property_t *);
extern void ecma_set_property_lcached (ecma_property_t *, bool);
ecma_value_t ecma_create_exception (ecma_value_t value, uint32_t options);
ecma_value_t ecma_create_exception_from_context (void);
ecma_value_t ecma_create_exception_from_object (ecma_object_t *object_p);
void ecma_throw_exception (ecma_value_t value);
extern ecma_property_descriptor_t ecma_make_empty_property_descriptor (void);
extern void ecma_free_property_descriptor (ecma_property_descriptor_t *);
extern ecma_property_descriptor_t ecma_get_property_descriptor_from_property (ecma_property_t *);
extern ecma_property_t *ecma_get_next_property_pair (ecma_property_pair_t *);
extern void ecma_bytecode_ref (ecma_compiled_code_t *);
extern void ecma_bytecode_deref (ecma_compiled_code_t *);
void ecma_script_deref (ecma_value_t script_value);
void ecma_bytecode_ref (ecma_compiled_code_t *bytecode_p);
void ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p);
ecma_value_t ecma_script_get_from_value (ecma_value_t value);
ecma_value_t *ecma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t *bytecode_header_p);
ecma_value_t *ecma_compiled_code_resolve_function_name (const ecma_compiled_code_t *bytecode_header_p);
ecma_collection_t *ecma_compiled_code_get_tagged_template_collection (const ecma_compiled_code_t *bytecode_header_p);
#if JERRY_LINE_INFO
uint8_t *ecma_compiled_code_get_line_info (const ecma_compiled_code_t *bytecode_header_p);
#endif /* JERRY_LINE_INFO */
ecma_value_t ecma_get_source_name (const ecma_compiled_code_t *bytecode_p);
#if (JERRY_STACK_LIMIT != 0)
uintptr_t ecma_get_current_stack_usage (void);
#endif /* (JERRY_STACK_LIMIT != 0) */
/* ecma-helpers-external-pointers.c */
extern bool
ecma_create_external_pointer_property (ecma_object_t *, ecma_internal_property_id_t, ecma_external_pointer_t);
extern bool
ecma_get_external_pointer_value (ecma_object_t *, ecma_internal_property_id_t, ecma_external_pointer_t *);
extern void
ecma_free_external_pointer_in_property (ecma_property_t *);
bool ecma_create_native_pointer_property (ecma_object_t *obj_p,
void *native_p,
const jerry_object_native_info_t *native_info_p);
ecma_native_pointer_t *ecma_get_native_pointer_value (ecma_object_t *obj_p,
const jerry_object_native_info_t *native_info_p);
bool ecma_delete_native_pointer_property (ecma_object_t *obj_p, const jerry_object_native_info_t *native_info_p);
/* ecma-helpers-conversion.c */
extern ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *, lit_utf8_size_t);
extern lit_utf8_size_t ecma_uint32_to_utf8_string (uint32_t, lit_utf8_byte_t *, lit_utf8_size_t);
extern uint32_t ecma_number_to_uint32 (ecma_number_t);
extern int32_t ecma_number_to_int32 (ecma_number_t);
extern lit_utf8_size_t ecma_number_to_utf8_string (ecma_number_t, lit_utf8_byte_t *, lit_utf8_size_t);
ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, lit_utf8_size_t str_size, uint32_t option);
ecma_number_t ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p,
lit_utf8_size_t str_size,
uint32_t radix,
uint32_t option);
lit_utf8_size_t ecma_uint32_to_utf8_string (uint32_t value, lit_utf8_byte_t *out_buffer_p, lit_utf8_size_t buffer_size);
uint32_t ecma_number_to_uint32 (ecma_number_t num);
int32_t ecma_number_to_int32 (ecma_number_t num);
lit_utf8_size_t ecma_number_to_utf8_string (ecma_number_t num, lit_utf8_byte_t *buffer_p, lit_utf8_size_t buffer_size);
/* ecma-helpers-errol.c */
extern lit_utf8_size_t ecma_errol0_dtoa (double, lit_utf8_byte_t *, int32_t *);
lit_utf8_size_t ecma_errol0_dtoa (double val, lit_utf8_byte_t *buffer_p, int32_t *exp_p);
/**
* @}
+56 -11
View File
@@ -1,4 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,14 +13,16 @@
* limitations under the License.
*/
#include "ecma-init-finalize.h"
#include "ecma-builtins.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
#include "ecma-init-finalize.h"
#include "ecma-lcache.h"
#include "ecma-lex-env.h"
#include "ecma-literal-storage.h"
#include "jmem-allocator.h"
#include "jcontext.h"
#include "jmem.h"
/** \addtogroup ecma ECMA
* @{
@@ -29,16 +31,40 @@
* @{
*/
/**
* Maximum number of GC loops on cleanup.
*/
#define JERRY_GC_LOOP_LIMIT 100
/**
* Initialize ECMA components
*/
void
ecma_init (void)
{
ecma_lcache_init ();
ecma_init_global_lex_env ();
#if (JERRY_GC_MARK_LIMIT != 0)
JERRY_CONTEXT (ecma_gc_mark_recursion_limit) = JERRY_GC_MARK_LIMIT;
#endif /* (JERRY_GC_MARK_LIMIT != 0) */
jmem_register_free_unused_memory_callback (ecma_free_unused_memory);
ecma_init_global_environment ();
#if JERRY_PROPERTY_HASHMAP
JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) = ECMA_PROP_HASHMAP_ALLOC_ON;
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_HIGH_PRESSURE_GC;
#endif /* JERRY_PROPERTY_HASHMAP */
#if (JERRY_STACK_LIMIT != 0)
volatile int sp;
JERRY_CONTEXT (stack_base) = (uintptr_t) &sp;
#endif /* (JERRY_STACK_LIMIT != 0) */
ecma_job_queue_init ();
JERRY_CONTEXT (current_new_target_p) = NULL;
#if JERRY_BUILTIN_TYPEDARRAY
JERRY_CONTEXT (arraybuffer_compact_allocation_limit) = 256;
#endif /* JERRY_BUILTIN_TYPEDARRAY */
} /* ecma_init */
/**
@@ -47,11 +73,30 @@ ecma_init (void)
void
ecma_finalize (void)
{
jmem_unregister_free_unused_memory_callback (ecma_free_unused_memory);
JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) == NULL);
ecma_finalize_global_environment ();
uint8_t runs = 0;
do
{
ecma_gc_run ();
if (++runs >= JERRY_GC_LOOP_LIMIT)
{
jerry_fatal (JERRY_FATAL_UNTERMINATED_GC_LOOPS);
}
} while (JERRY_CONTEXT (ecma_gc_new_objects) != 0);
jmem_cpointer_t *global_symbols_cp = JERRY_CONTEXT (global_symbols_cp);
for (uint32_t i = 0; i < ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT; i++)
{
if (global_symbols_cp[i] != JMEM_CP_NULL)
{
ecma_deref_ecma_string (ECMA_GET_NON_NULL_POINTER (ecma_string_t, global_symbols_cp[i]));
}
}
ecma_finalize_global_lex_env ();
ecma_finalize_builtins ();
ecma_gc_run (JMEM_FREE_UNUSED_MEMORY_SEVERITY_LOW);
ecma_finalize_lit_storage ();
} /* ecma_finalize */
+3 -3
View File
@@ -1,4 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,8 +23,8 @@
* @{
*/
extern void ecma_init (void);
extern void ecma_finalize (void);
void ecma_init (void);
void ecma_finalize (void);
/**
* @}
+91 -101
View File
@@ -1,5 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,10 +13,12 @@
* limitations under the License.
*/
#include "ecma-lcache.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-lcache.h"
#include "jcontext.h"
/** \addtogroup ecma ECMA
@@ -27,39 +28,44 @@
* @{
*/
#ifndef CONFIG_ECMA_LCACHE_DISABLE
#if JERRY_LCACHE
/**
* Bitshift index for calculating hash.
*/
#if JERRY_CPOINTER_32_BIT
#define ECMA_LCACHE_HASH_BITSHIFT_INDEX (2 * JMEM_ALIGNMENT_LOG)
#else /* !JERRY_CPOINTER_32_BIT */
#define ECMA_LCACHE_HASH_BITSHIFT_INDEX 0
#endif /* JERRY_CPOINTER_32_BIT */
/**
* Mask for hash bits
*/
#define ECMA_LCACHE_HASH_MASK (ECMA_LCACHE_HASH_ROWS_COUNT - 1)
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
#define ECMA_LCACHE_HASH_MASK ((ECMA_LCACHE_HASH_ROWS_COUNT - 1) << ECMA_LCACHE_HASH_BITSHIFT_INDEX)
/**
* Initialize LCache
* Bitshift index for creating property identifier
*/
void
ecma_lcache_init (void)
{
#ifndef CONFIG_ECMA_LCACHE_DISABLE
memset (JERRY_HASH_TABLE_CONTEXT (table), 0, sizeof (jerry_hash_table_t));
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
} /* ecma_lcache_init */
#define ECMA_LCACHE_HASH_ENTRY_ID_SHIFT (8 * sizeof (jmem_cpointer_t))
/**
* Create property identifier
*/
#define ECMA_LCACHE_CREATE_ID(object_cp, name_cp) \
(((ecma_lcache_hash_entry_id_t) (object_cp) << ECMA_LCACHE_HASH_ENTRY_ID_SHIFT) | (name_cp))
#ifndef CONFIG_ECMA_LCACHE_DISABLE
/**
* Invalidate specified LCache entry
*/
static inline void __attr_always_inline___
static inline void JERRY_ATTR_ALWAYS_INLINE
ecma_lcache_invalidate_entry (ecma_lcache_hash_entry_t *entry_p) /**< entry to invalidate */
{
JERRY_ASSERT (entry_p != NULL);
JERRY_ASSERT (entry_p->object_cp != ECMA_NULL_POINTER);
JERRY_ASSERT (entry_p->prop_name_cp != ECMA_NULL_POINTER);
JERRY_ASSERT (entry_p->id != 0);
JERRY_ASSERT (entry_p->prop_p != NULL);
entry_p->object_cp = ECMA_NULL_POINTER;
entry_p->id = 0;
ecma_set_property_lcached (entry_p->prop_p, false);
} /* ecma_lcache_invalidate_entry */
@@ -68,68 +74,61 @@ ecma_lcache_invalidate_entry (ecma_lcache_hash_entry_t *entry_p) /**< entry to i
*
* @return row index
*/
static inline size_t __attr_always_inline___
static inline size_t JERRY_ATTR_ALWAYS_INLINE
ecma_lcache_row_index (jmem_cpointer_t object_cp, /**< compressed pointer to object */
const ecma_string_t *prop_name_p) /**< proeprty name */
jmem_cpointer_t name_cp) /**< compressed pointer to property name */
{
/* Randomize the hash of the property name with the object pointer using a xor operation,
/* Randomize the property name with the object pointer using a xor operation,
* so properties of different objects with the same name can be cached effectively. */
return (size_t) ((ecma_string_hash (prop_name_p) ^ object_cp) & ECMA_LCACHE_HASH_MASK);
return (size_t) (((name_cp ^ object_cp) & ECMA_LCACHE_HASH_MASK) >> ECMA_LCACHE_HASH_BITSHIFT_INDEX);
} /* ecma_lcache_row_index */
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
/**
* Insert an entry into LCache
*/
void
ecma_lcache_insert (ecma_object_t *object_p, /**< object */
ecma_string_t *prop_name_p, /**< property name */
ecma_lcache_insert (const ecma_object_t *object_p, /**< object */
const jmem_cpointer_t name_cp, /**< property name */
ecma_property_t *prop_p) /**< property */
{
JERRY_ASSERT (object_p != NULL);
JERRY_ASSERT (prop_name_p != NULL);
JERRY_ASSERT (prop_p != NULL && !ecma_is_property_lcached (prop_p));
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (prop_p) == ECMA_PROPERTY_TYPE_NAMEDDATA
|| ECMA_PROPERTY_GET_TYPE (prop_p) == ECMA_PROPERTY_TYPE_NAMEDACCESSOR);
JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*prop_p));
#ifndef CONFIG_ECMA_LCACHE_DISABLE
jmem_cpointer_t object_cp;
ECMA_SET_NON_NULL_POINTER (object_cp, object_p);
size_t row_index = ecma_lcache_row_index (object_cp, prop_name_p);
ecma_lcache_hash_entry_t *entries_p = JERRY_HASH_TABLE_CONTEXT (table)[row_index];
size_t row_index = ecma_lcache_row_index (object_cp, name_cp);
ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index];
ecma_lcache_hash_entry_t *entry_end_p = entry_p + ECMA_LCACHE_HASH_ROW_LENGTH;
int32_t entry_index;
for (entry_index = 0; entry_index < ECMA_LCACHE_HASH_ROW_LENGTH; entry_index++)
do
{
if (entries_p[entry_index].object_cp == ECMA_NULL_POINTER)
if (entry_p->id == 0)
{
break;
}
}
if (entry_index == ECMA_LCACHE_HASH_ROW_LENGTH)
{
/* Invalidate the last entry. */
ecma_lcache_invalidate_entry (entries_p + ECMA_LCACHE_HASH_ROW_LENGTH - 1);
/* Shift other entries towards the end. */
for (uint32_t i = ECMA_LCACHE_HASH_ROW_LENGTH - 1; i > 0; i--)
{
entries_p[i] = entries_p[i - 1];
goto insert;
}
entry_index = 0;
entry_p++;
} while (entry_p < entry_end_p);
/* Invalidate the last entry. */
ecma_lcache_invalidate_entry (--entry_p);
/* Shift other entries towards the end. */
for (uint32_t i = 0; i < ECMA_LCACHE_HASH_ROW_LENGTH - 1; i++)
{
entry_p->id = entry_p[-1].id;
entry_p->prop_p = entry_p[-1].prop_p;
entry_p--;
}
ecma_lcache_hash_entry_t *entry_p = entries_p + entry_index;
ECMA_SET_NON_NULL_POINTER (entry_p->object_cp, object_p);
ECMA_SET_NON_NULL_POINTER (entry_p->prop_name_cp, prop_name_p);
insert:
entry_p->prop_p = prop_p;
entry_p->id = ECMA_LCACHE_CREATE_ID (object_cp, name_cp);
ecma_set_property_lcached (entry_p->prop_p, true);
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
} /* ecma_lcache_insert */
/**
@@ -138,49 +137,44 @@ ecma_lcache_insert (ecma_object_t *object_p, /**< object */
* @return a pointer to an ecma_property_t if the lookup is successful
* NULL otherwise
*/
inline ecma_property_t * __attr_always_inline___
ecma_lcache_lookup (ecma_object_t *object_p, /**< object */
extern inline ecma_property_t *JERRY_ATTR_ALWAYS_INLINE
ecma_lcache_lookup (const ecma_object_t *object_p, /**< object */
const ecma_string_t *prop_name_p) /**< property's name */
{
JERRY_ASSERT (object_p != NULL);
JERRY_ASSERT (prop_name_p != NULL);
#ifndef CONFIG_ECMA_LCACHE_DISABLE
jmem_cpointer_t object_cp;
ECMA_SET_NON_NULL_POINTER (object_cp, object_p);
size_t row_index = ecma_lcache_row_index (object_cp, prop_name_p);
ecma_lcache_hash_entry_t *entry_p = JERRY_HASH_TABLE_CONTEXT (table) [row_index];
ecma_lcache_hash_entry_t *entry_end_p = entry_p + ECMA_LCACHE_HASH_ROW_LENGTH;
ecma_string_container_t prop_container = ECMA_STRING_GET_CONTAINER (prop_name_p);
ecma_property_t prop_name_type = ECMA_DIRECT_STRING_PTR;
jmem_cpointer_t prop_name_cp;
while (entry_p < entry_end_p)
if (JERRY_UNLIKELY (ECMA_IS_DIRECT_STRING (prop_name_p)))
{
if (entry_p->object_cp == object_cp)
prop_name_type = (ecma_property_t) ECMA_GET_DIRECT_STRING_TYPE (prop_name_p);
prop_name_cp = (jmem_cpointer_t) ECMA_GET_DIRECT_STRING_VALUE (prop_name_p);
}
else
{
ECMA_SET_NON_NULL_POINTER (prop_name_cp, prop_name_p);
}
size_t row_index = ecma_lcache_row_index (object_cp, prop_name_cp);
ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index];
ecma_lcache_hash_entry_t *entry_end_p = entry_p + ECMA_LCACHE_HASH_ROW_LENGTH;
ecma_lcache_hash_entry_id_t id = ECMA_LCACHE_CREATE_ID (object_cp, prop_name_cp);
do
{
if (entry_p->id == id && JERRY_LIKELY (ECMA_PROPERTY_GET_NAME_TYPE (*entry_p->prop_p) == prop_name_type))
{
ecma_string_t *entry_prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t,
entry_p->prop_name_cp);
JERRY_ASSERT ((prop_name_p->hash & ECMA_LCACHE_HASH_MASK) == (entry_prop_name_p->hash & ECMA_LCACHE_HASH_MASK));
if (prop_name_p == entry_prop_name_p
|| (prop_container > ECMA_STRING_CONTAINER_HEAP_LONG_UTF8_STRING
&& prop_container == ECMA_STRING_GET_CONTAINER (entry_prop_name_p)
&& prop_name_p->u.common_field == entry_prop_name_p->u.common_field))
{
ecma_property_t *prop_p = entry_p->prop_p;
JERRY_ASSERT (prop_p != NULL && ecma_is_property_lcached (prop_p));
return prop_p;
}
else
{
/* They can be equal, but generic string comparison is too costly. */
}
JERRY_ASSERT (entry_p->prop_p != NULL && ecma_is_property_lcached (entry_p->prop_p));
return entry_p->prop_p;
}
entry_p++;
}
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
} while (entry_p < entry_end_p);
return NULL;
} /* ecma_lcache_lookup */
@@ -189,42 +183,38 @@ ecma_lcache_lookup (ecma_object_t *object_p, /**< object */
* Invalidate LCache entries associated with given object and property name / property
*/
void
ecma_lcache_invalidate (ecma_object_t *object_p, /**< object */
ecma_string_t *prop_name_p, /**< property's name */
ecma_lcache_invalidate (const ecma_object_t *object_p, /**< object */
const jmem_cpointer_t name_cp, /**< property name */
ecma_property_t *prop_p) /**< property */
{
JERRY_ASSERT (object_p != NULL);
JERRY_ASSERT (prop_name_p != NULL);
JERRY_ASSERT (prop_p != NULL && ecma_is_property_lcached (prop_p));
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (prop_p) == ECMA_PROPERTY_TYPE_NAMEDDATA
|| ECMA_PROPERTY_GET_TYPE (prop_p) == ECMA_PROPERTY_TYPE_NAMEDACCESSOR);
JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*prop_p));
#ifndef CONFIG_ECMA_LCACHE_DISABLE
jmem_cpointer_t object_cp;
ECMA_SET_NON_NULL_POINTER (object_cp, object_p);
size_t row_index = ecma_lcache_row_index (object_cp, prop_name_p);
ecma_lcache_hash_entry_t *entry_p = JERRY_HASH_TABLE_CONTEXT (table) [row_index];
size_t row_index = ecma_lcache_row_index (object_cp, name_cp);
ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index];
for (uint32_t entry_index = 0; entry_index < ECMA_LCACHE_HASH_ROW_LENGTH; entry_index++)
while (true)
{
if (entry_p->object_cp != ECMA_NULL_POINTER && entry_p->prop_p == prop_p)
/* The property must be present. */
JERRY_ASSERT (entry_p - JERRY_CONTEXT (lcache)[row_index] < ECMA_LCACHE_HASH_ROW_LENGTH);
if (entry_p->id != 0 && entry_p->prop_p == prop_p)
{
JERRY_ASSERT (ECMA_GET_NON_NULL_POINTER (ecma_string_t,
entry_p->prop_name_cp) == prop_name_p);
JERRY_ASSERT (entry_p->object_cp == object_cp);
JERRY_ASSERT (entry_p->id == ECMA_LCACHE_CREATE_ID (object_cp, name_cp));
ecma_lcache_invalidate_entry (entry_p);
return;
}
entry_p++;
}
/* The property must be present. */
JERRY_UNREACHABLE ();
#endif /* !CONFIG_ECMA_LCACHE_DISABLE */
} /* ecma_lcache_invalidate */
#endif /* JERRY_LCACHE */
/**
* @}
* @}
+9 -5
View File
@@ -1,4 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,10 +23,14 @@
* @{
*/
extern void ecma_lcache_init (void);
extern void ecma_lcache_insert (ecma_object_t *, ecma_string_t *, ecma_property_t *);
extern ecma_property_t *ecma_lcache_lookup (ecma_object_t *, const ecma_string_t *);
extern void ecma_lcache_invalidate (ecma_object_t *, ecma_string_t *, ecma_property_t *);
#include "ecma-globals.h"
#if JERRY_LCACHE
void ecma_lcache_insert (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p);
ecma_property_t *ecma_lcache_lookup (const ecma_object_t *object_p, const ecma_string_t *prop_name_p);
void ecma_lcache_invalidate (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p);
#endif /* JERRY_LCACHE */
/**
* @}
+271
View File
@@ -0,0 +1,271 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-line-info.h"
#include "ecma-helpers.h"
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmalineinfo Line info
* @{
*/
#if JERRY_LINE_INFO
/* The layout of the structure is defined in js-parser-line-info-create.c */
JERRY_STATIC_ASSERT ((ECMA_LINE_INFO_COLUMN_DEFAULT - 1) == ((ECMA_LINE_INFO_ENCODE_TWO_BYTE >> 1) - 1),
ecma_line_info_column_1_must_be_accessible_with_the_highest_one_byte_negative_value);
/**
* Decodes an uint32_t number, and updates the buffer position.
* Numbers expected to be larger values.
*
* @return the decoded value
*/
uint32_t
ecma_line_info_decode_vlq (uint8_t **buffer_p) /**< [in/out] target buffer */
{
uint8_t *source_p = *buffer_p;
uint32_t value = 0;
do
{
value = (value << ECMA_LINE_INFO_VLQ_SHIFT) | (*source_p & ECMA_LINE_INFO_VLQ_MASK);
} while (*source_p++ & ECMA_LINE_INFO_VLQ_CONTINUE);
*buffer_p = source_p;
return value;
} /* ecma_line_info_decode_vlq */
/**
* Decodes an uint32_t number, and updates the buffer position.
* Numbers expected to be smaller values.
*
* @return the decoded value
*/
static uint32_t
ecma_line_info_decode_small (uint8_t **buffer_p) /**< [in/out] target buffer */
{
uint8_t *source_p = *buffer_p;
uint32_t type = source_p[0];
*buffer_p = source_p + 1;
if (type < ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN)
{
return type;
}
if (type == ECMA_LINE_INFO_ENCODE_TWO_BYTE)
{
*buffer_p = source_p + 2;
return ((uint32_t) source_p[1]) + ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN;
}
JERRY_ASSERT (type == ECMA_LINE_INFO_ENCODE_VLQ);
return ecma_line_info_decode_vlq (buffer_p) + ECMA_LINE_INFO_ENCODE_VLQ_MIN;
} /* ecma_line_info_decode_small */
/**
* Updates a value using an encoded difference.
*
* @return updated value
*/
extern inline uint32_t JERRY_ATTR_ALWAYS_INLINE
ecma_line_info_difference_update (uint32_t current_value, /**< current value */
uint32_t difference_value) /**< encoded difference */
{
if ((difference_value & 0x1) == ECMA_LINE_INFO_INCREASE)
{
return current_value + (difference_value >> 1) + 1;
}
return current_value - (difference_value >> 1);
} /* ecma_line_info_difference_update */
/**
* Release line info data.
*/
void
ecma_line_info_free (uint8_t *line_info_p) /**< line info buffer */
{
uint8_t *source_p = line_info_p;
uint32_t total_length = ecma_line_info_decode_vlq (&source_p);
jmem_heap_free_block (line_info_p, total_length + (uint32_t) (source_p - line_info_p));
} /* ecma_line_info_free */
/**
* Returns the line/column information for a given byte code offset.
*/
void
ecma_line_info_get (uint8_t *line_info_p, /**< line info buffer */
uint32_t offset, /**< byte code offset */
jerry_frame_location_t *location_p) /**< [out] location */
{
uint32_t line = 1;
uint32_t column = ECMA_LINE_INFO_COLUMN_DEFAULT;
uint32_t end_offset = 0;
uint32_t end_offset_increase;
uint32_t value;
/* Skip total_length. */
ecma_line_info_decode_vlq (&line_info_p);
while (true)
{
value = ecma_line_info_decode_vlq (&line_info_p);
line = ecma_line_info_difference_update (line, value);
if (*line_info_p == 0)
{
break;
}
uint8_t *size_p = line_info_p + *line_info_p + (ECMA_LINE_INFO_STREAM_SIZE_MIN + 1);
uint32_t next_end_offset = end_offset + ecma_line_info_decode_vlq (&size_p);
if (offset < next_end_offset)
{
break;
}
end_offset = next_end_offset;
line_info_p = size_p;
}
line_info_p++;
do
{
end_offset_increase = ecma_line_info_decode_small (&line_info_p);
if (end_offset_increase & ECMA_LINE_INFO_HAS_LINE)
{
value = ecma_line_info_decode_small (&line_info_p);
line = ecma_line_info_difference_update (line, value);
column = ECMA_LINE_INFO_COLUMN_DEFAULT;
}
end_offset_increase >>= 1;
value = ecma_line_info_decode_small (&line_info_p);
column = ecma_line_info_difference_update (column, value);
end_offset += end_offset_increase;
} while (end_offset_increase != 0 && end_offset <= offset);
location_p->line = line;
location_p->column = column;
} /* ecma_line_info_get */
#if JERRY_PARSER_DUMP_BYTE_CODE
/**
* Dumps line info data.
*/
void
ecma_line_info_dump (uint8_t *line_info_p) /**< dumps line info data */
{
bool block_last = false;
uint32_t block_line = 1;
uint32_t block_byte_code_offset = 0;
uint32_t value;
value = ecma_line_info_decode_vlq (&line_info_p);
JERRY_DEBUG_MSG ("\nLine info size: %d bytes\n", (int) value);
while (true)
{
value = ecma_line_info_decode_vlq (&line_info_p);
block_line = ecma_line_info_difference_update (block_line, value);
JERRY_DEBUG_MSG ("\nNew block: line: %d", (int) block_line);
if (*line_info_p == 0)
{
JERRY_DEBUG_MSG (" StreamLength: [last]\n");
block_last = true;
}
else
{
uint8_t *size_p = line_info_p + *line_info_p + (ECMA_LINE_INFO_STREAM_SIZE_MIN + 1);
value = ecma_line_info_decode_vlq (&size_p);
JERRY_DEBUG_MSG (" StreamLength: %d ByteCodeSize: %d\n",
(int) (*line_info_p + ECMA_LINE_INFO_STREAM_SIZE_MIN),
(int) value);
}
line_info_p++;
uint32_t stream_line = block_line;
uint32_t stream_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
uint32_t stream_end_offset = block_byte_code_offset;
while (true)
{
uint32_t stream_end_offset_increase = ecma_line_info_decode_small (&line_info_p);
if (stream_end_offset_increase & ECMA_LINE_INFO_HAS_LINE)
{
value = ecma_line_info_decode_small (&line_info_p);
stream_line = ecma_line_info_difference_update (stream_line, value);
stream_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
}
stream_end_offset_increase >>= 1;
value = ecma_line_info_decode_small (&line_info_p);
stream_column = ecma_line_info_difference_update (stream_column, value);
if (stream_end_offset_increase == 0)
{
JERRY_DEBUG_MSG (" ByteCodeEndOffset: [unterminated] Line: %d Column: %d\n",
(int) stream_line,
(int) stream_column);
break;
}
stream_end_offset += stream_end_offset_increase;
JERRY_DEBUG_MSG (" ByteCodeEndOffset: %d Line: %d Column: %d\n",
(int) stream_end_offset,
(int) stream_line,
(int) stream_column);
}
if (block_last)
{
break;
}
block_byte_code_offset += ecma_line_info_decode_vlq (&line_info_p);
}
} /* ecma_line_info_dump */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
#endif /* JERRY_LINE_INFO */
/**
* @}
* @}
*/
+114
View File
@@ -0,0 +1,114 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ECMA_LINE_INFO_H
#define ECMA_LINE_INFO_H
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmalineinfo Line info
* @{
*/
#if JERRY_LINE_INFO
#include "ecma-globals.h"
/**
* Increase the current value of line or column.
*/
#define ECMA_LINE_INFO_INCREASE 0x0
/**
* Decrease the current value of line or column.
*/
#define ECMA_LINE_INFO_DECREASE 0x1
/**
* Line update is present.
*/
#define ECMA_LINE_INFO_HAS_LINE 0x1
/**
* A default value for columns after a line update.
*/
#define ECMA_LINE_INFO_COLUMN_DEFAULT 127
/**
* Vlq encoding: flag which is set for all bytes except the last one.
*/
#define ECMA_LINE_INFO_VLQ_CONTINUE 0x80
/**
* Vlq encoding: mask to decode the number fragment.
*/
#define ECMA_LINE_INFO_VLQ_MASK 0x7f
/**
* Vlq encoding: number of bits stored in a byte.
*/
#define ECMA_LINE_INFO_VLQ_SHIFT 7
/**
* Small encoding: a value which represents a two byte long number.
*/
#define ECMA_LINE_INFO_ENCODE_TWO_BYTE (UINT8_MAX - 1)
/**
* Small encoding: minimum value of an encoded two byte long number.
*/
#define ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN (UINT8_MAX - 1)
/**
* Small encoding: a value which represents a three byte long number.
*/
#define ECMA_LINE_INFO_ENCODE_VLQ UINT8_MAX
/**
* Small encoding: minimum value of an encoded three byte long number.
*/
#define ECMA_LINE_INFO_ENCODE_VLQ_MIN (ECMA_LINE_INFO_ENCODE_TWO_BYTE_MIN + UINT8_MAX + 1)
/**
* Maximum number of line/column entries stored in a stream.
*/
#define ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX 48
/**
* Minimum size of a stream (except the last one).
*/
#define ECMA_LINE_INFO_STREAM_SIZE_MIN ((2 * ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX) - 1)
/* Helper functions for parser/js/js-parser-line-info-create.c. */
uint32_t ecma_line_info_decode_vlq (uint8_t **buffer_p);
uint32_t ecma_line_info_difference_update (uint32_t current_value, uint32_t difference_value);
/* General functions. */
void ecma_line_info_free (uint8_t *line_info_p);
void ecma_line_info_get (uint8_t *line_info_p, uint32_t offset, jerry_frame_location_t *location_p);
#if JERRY_PARSER_DUMP_BYTE_CODE
void ecma_line_info_dump (uint8_t *line_info_p);
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
#endif /* JERRY_LINE_INFO */
/**
* @}
* @}
*/
#endif /* !ECMA_LINE_INFO_H */
File diff suppressed because it is too large Load Diff
+28 -18
View File
@@ -1,5 +1,4 @@
/* Copyright 2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,7 +17,8 @@
#define ECMA_LIT_STORAGE_H
#include "ecma-globals.h"
#include "jmem-allocator.h"
#include "jmem.h"
#include "lit-globals.h"
/** \addtogroup ecma ECMA
@@ -28,31 +28,41 @@
* @{
*/
#if JERRY_SNAPSHOT_SAVE
/**
* Snapshot literal - offset map
*/
typedef struct
{
jmem_cpointer_t literal_id; /**< literal id */
jmem_cpointer_t literal_offset; /**< literal offset */
ecma_value_t literal_id; /**< literal id */
ecma_value_t literal_offset; /**< literal offset */
} lit_mem_to_snapshot_id_map_entry_t;
#endif /* JERRY_SNAPSHOT_SAVE */
extern void ecma_finalize_lit_storage (void);
void ecma_finalize_lit_storage (void);
extern jmem_cpointer_t ecma_find_or_create_literal_string (const lit_utf8_byte_t *, lit_utf8_size_t);
extern jmem_cpointer_t ecma_find_or_create_literal_number (ecma_number_t);
ecma_value_t ecma_find_or_create_literal_string (const lit_utf8_byte_t *chars_p, lit_utf8_size_t size, bool is_ascii);
ecma_value_t ecma_find_or_create_literal_number (ecma_number_t number_arg);
#if JERRY_BUILTIN_BIGINT
ecma_value_t ecma_find_or_create_literal_bigint (ecma_value_t bigint);
#endif /* JERRY_BUILTIN_BIGINT */
#ifdef JERRY_ENABLE_SNAPSHOT_SAVE
extern bool
ecma_save_literals_for_snapshot (uint8_t *, size_t, size_t *,
lit_mem_to_snapshot_id_map_entry_t **, uint32_t *, uint32_t *);
#endif /* JERRY_ENABLE_SNAPSHOT_SAVE */
#if JERRY_SNAPSHOT_SAVE
void ecma_save_literals_append_value (ecma_value_t value, ecma_collection_t *lit_pool_p);
void ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, ecma_collection_t *lit_pool_p);
bool ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p,
uint32_t *buffer_p,
size_t buffer_size,
size_t *in_out_buffer_offset_p,
lit_mem_to_snapshot_id_map_entry_t **out_map_p,
uint32_t *out_map_len_p);
#endif /* JERRY_SNAPSHOT_SAVE */
#ifdef JERRY_ENABLE_SNAPSHOT_EXEC
extern bool
ecma_load_literals_from_snapshot (const uint8_t *, uint32_t,
lit_mem_to_snapshot_id_map_entry_t **, uint32_t *);
#endif /* JERRY_ENABLE_SNAPSHOT_EXEC */
#if JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE
ecma_value_t ecma_snapshot_get_literal (const uint8_t *literal_base_p, ecma_value_t literal_value);
ecma_value_t *ecma_snapshot_resolve_serializable_values (const ecma_compiled_code_t *compiled_code_p,
uint8_t *byte_code_end_p);
#endif /* JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE */
/**
* @}
File diff suppressed because it is too large Load Diff
+132
View File
@@ -0,0 +1,132 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ECMA_MODULE_H
#define ECMA_MODULE_H
#include "ecma-globals.h"
#include "common.h"
#if JERRY_MODULE_SYSTEM
#define ECMA_MODULE_MAX_PATH 255u
/**
* Module status flags.
*/
typedef enum
{
ECMA_MODULE_IS_NATIVE = (1 << 0), /**< native module */
ECMA_MODULE_HAS_NAMESPACE = (1 << 1), /**< namespace object has been initialized */
} ecma_module_flags_t;
/**
* Imported or exported names, such as "a as b"
* Note: See https://www.ecma-international.org/ecma-262/6.0/#table-39
* and https://www.ecma-international.org/ecma-262/6.0/#table-41
*/
typedef struct ecma_module_names
{
struct ecma_module_names *next_p; /**< next linked list node */
ecma_string_t *imex_name_p; /**< Import/export name of the item */
ecma_string_t *local_name_p; /**< Local name of the item */
} ecma_module_names_t;
/**
* Module structure storing an instance of a module
*
* Note:
* The imports_p list follows the order of import-from/export-from statements in the source
* code of a module, even if a given module specifier is only used by export-from statements.
*/
typedef struct ecma_module
{
/* Note: state is stored in header.u.class_prop.extra_info */
ecma_extended_object_t header; /**< header part */
/* TODO(dbatyai): These could be compressed pointers */
ecma_object_t *scope_p; /**< lexical lenvironment of the module */
ecma_object_t *namespace_object_p; /**< namespace object of the module */
struct ecma_module_node *imports_p; /**< import requests of the module */
ecma_module_names_t *local_exports_p; /**< local exports of the module */
struct ecma_module_node *indirect_exports_p; /**< indirect exports of the module */
struct ecma_module_node *star_exports_p; /**< star exports of the module */
/* Code used for evaluating a module */
union
{
ecma_compiled_code_t *compiled_code_p; /**< compiled code for the module */
jerry_native_module_evaluate_cb_t callback; /**< callback for evaluating native modules */
} u;
} ecma_module_t;
/**
* Module node to store imports / exports.
*
* Note:
* Only one module node is created for each module specifier: the names are
* concatenated if the same specifier is used multiple times in the source code.
* However, multiple nodes are created for modules with multiple alias
* (for example ./a.mjs and ././a.mjs can refer to the same module).
*/
typedef struct ecma_module_node
{
struct ecma_module_node *next_p; /**< next linked list node */
ecma_module_names_t *module_names_p; /**< names of the requested import/export node */
union
{
ecma_value_t path_or_module; /**< imports: module specifier (if string) or module reference (if object) */
ecma_value_t *module_object_p; /**< non-imports: reference to a path_or_module field in the imports */
} u;
} ecma_module_node_t;
/**
* A list of module records that can be used to identify circular imports during resolution
*/
typedef struct ecma_module_resolve_set
{
struct ecma_module_resolve_set *next_p; /**< next in linked list */
ecma_module_t *module_p; /**< module */
ecma_string_t *name_p; /**< identifier name */
} ecma_module_resolve_set_t;
/**
* A list that is used like a stack to drive the resolution process, instead of recursion.
*/
typedef struct ecma_module_resolve_stack
{
struct ecma_module_resolve_stack *next_p; /**< next in linked list */
ecma_module_t *module_p; /**< module request */
ecma_string_t *export_name_p; /**< export identifier name */
bool resolving; /**< flag storing wether the current frame started resolving */
} ecma_module_resolve_stack_t;
ecma_value_t ecma_module_initialize (ecma_module_t *module_p);
ecma_module_t *ecma_module_get_resolved_module (ecma_value_t module_val);
ecma_value_t ecma_module_link (ecma_module_t *module_p, jerry_module_resolve_cb_t callback_p, void *user_p);
ecma_value_t ecma_module_evaluate (ecma_module_t *module_p);
ecma_value_t ecma_module_import (ecma_value_t specifier, ecma_value_t user_value);
ecma_module_t *ecma_module_create (void);
void ecma_module_cleanup_context (void);
void ecma_module_release_module_names (ecma_module_names_t *module_name_p);
void ecma_module_release_module (ecma_module_t *module_p);
#endif /* JERRY_MODULE_SYSTEM */
#endif /* !ECMA_MODULE_H */
+171 -158
View File
@@ -1,5 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,9 +13,12 @@
* limitations under the License.
*/
#include "ecma-property-hashmap.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-property-hashmap.h"
#include "jcontext.h"
#include "jrt-libc-includes.h"
/** \addtogroup ecma ECMA
@@ -26,7 +28,7 @@
* @{
*/
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
#if JERRY_PROPERTY_HASHMAP
/**
* Compute the total size of the property hashmap.
@@ -42,30 +44,26 @@
/**
* Stepping values for searching items in the hashmap.
*/
static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS] JERRY_CONST_DATA =
{
static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS] JERRY_ATTR_CONST_DATA = {
3, 5, 7, 11, 13, 17, 19, 23
};
/**
* Get the value of a bit in a bitmap.
*/
#define ECMA_PROPERTY_HASHMAP_GET_BIT(byte_p, index) \
((byte_p)[(index) >> 3] & (1 << ((index) & 0x7)))
#define ECMA_PROPERTY_HASHMAP_GET_BIT(byte_p, index) ((byte_p)[(index) >> 3] & (1 << ((index) &0x7)))
/**
* Clear the value of a bit in a bitmap.
*/
#define ECMA_PROPERTY_HASHMAP_CLEAR_BIT(byte_p, index) \
((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] & ~(1 << ((index) & 0x7))))
((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] & ~(1 << ((index) &0x7))))
/**
* Set the value of a bit in a bitmap.
*/
#define ECMA_PROPERTY_HASHMAP_SET_BIT(byte_p, index) \
((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] | (1 << ((index) & 0x7))))
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] | (1 << ((index) &0x7))))
/**
* Create a new property hashmap for the object.
@@ -74,29 +72,39 @@ static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF
void
ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
{
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
JERRY_ASSERT (ecma_get_property_list (object_p) != NULL);
JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (ecma_get_property_list (object_p)));
if (JERRY_CONTEXT (ecma_prop_hashmap_alloc_state) != ECMA_PROP_HASHMAP_ALLOC_ON)
{
return;
}
jmem_cpointer_t prop_iter_cp = object_p->u1.property_list_cp;
if (prop_iter_cp == JMEM_CP_NULL)
{
return;
}
uint32_t named_property_count = 0;
ecma_property_header_t *prop_iter_p = ecma_get_property_list (object_p);
while (prop_iter_p != NULL)
while (prop_iter_cp != JMEM_CP_NULL)
{
ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));
for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)
{
ecma_property_types_t type = ECMA_PROPERTY_GET_TYPE (prop_iter_p->types + i);
if (type == ECMA_PROPERTY_TYPE_NAMEDDATA || type == ECMA_PROPERTY_TYPE_NAMEDACCESSOR)
if (prop_iter_p->types[i] != ECMA_PROPERTY_TYPE_DELETED)
{
JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[i]));
named_property_count++;
}
}
prop_iter_p = ECMA_GET_POINTER (ecma_property_header_t,
prop_iter_p->next_property_cp);
prop_iter_cp = prop_iter_p->next_property_cp;
}
if (named_property_count < (ECMA_PROPERTY_HASMAP_MINIMUM_SIZE / 2))
{
return;
}
/* The max_property_count must be power of 2. */
@@ -119,65 +127,39 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
memset (hashmap_p, 0, total_size);
hashmap_p->header.types[0].type_and_flags = ECMA_PROPERTY_TYPE_HASHMAP;
hashmap_p->header.next_property_cp = object_p->property_list_or_bound_object_cp;
hashmap_p->header.types[0] = ECMA_PROPERTY_TYPE_HASHMAP;
hashmap_p->header.next_property_cp = object_p->u1.property_list_cp;
hashmap_p->max_property_count = max_property_count;
hashmap_p->null_count = max_property_count - named_property_count;
hashmap_p->unused_count = max_property_count - named_property_count;
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
uint8_t *bits_p = (uint8_t *) (pair_list_p + max_property_count);
uint32_t mask = max_property_count - 1;
uint8_t shift_counter = 0;
prop_iter_cp = object_p->u1.property_list_cp;
ECMA_SET_NON_NULL_POINTER (object_p->u1.property_list_cp, hashmap_p);
if (max_property_count <= LIT_STRING_HASH_LIMIT)
{
hashmap_p->header.types[1].type_and_flags = 0;
}
else
{
while (max_property_count > LIT_STRING_HASH_LIMIT)
{
shift_counter++;
max_property_count >>= 1;
}
}
hashmap_p->header.types[1].type_and_flags = shift_counter;
prop_iter_p = ecma_get_property_list (object_p);
ECMA_SET_POINTER (object_p->property_list_or_bound_object_cp, hashmap_p);
while (prop_iter_p != NULL)
while (prop_iter_cp != JMEM_CP_NULL)
{
ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));
for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)
{
ecma_property_types_t type = ECMA_PROPERTY_GET_TYPE (prop_iter_p->types + i);
if (!(type == ECMA_PROPERTY_TYPE_NAMEDDATA || type == ECMA_PROPERTY_TYPE_NAMEDACCESSOR))
if (prop_iter_p->types[i] == ECMA_PROPERTY_TYPE_DELETED)
{
continue;
}
ecma_property_pair_t *property_pair_p = (ecma_property_pair_t *) prop_iter_p;
ecma_string_t *name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t,
property_pair_p->names_cp[i]);
JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[i]));
uint32_t entry_index = name_p->hash;
ecma_property_pair_t *property_pair_p = (ecma_property_pair_t *) prop_iter_p;
uint32_t entry_index = ecma_string_get_property_name_hash (prop_iter_p->types[i], property_pair_p->names_cp[i]);
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
if (mask < LIT_STRING_HASH_LIMIT)
{
entry_index &= mask;
}
else
{
entry_index <<= shift_counter;
JERRY_ASSERT (entry_index <= mask);
}
entry_index &= mask;
#ifndef JERRY_NDEBUG
/* Because max_property_count (power of 2) and step (a prime
* number) are relative primes, all entries of the hasmap are
@@ -197,7 +179,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
#endif /* !JERRY_NDEBUG */
}
ECMA_SET_POINTER (pair_list_p[entry_index], property_pair_p);
ECMA_SET_NON_NULL_POINTER (pair_list_p[entry_index], property_pair_p);
if (i != 0)
{
@@ -205,12 +187,8 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
}
}
prop_iter_p = ECMA_GET_POINTER (ecma_property_header_t,
prop_iter_p->next_property_cp);
prop_iter_cp = prop_iter_p->next_property_cp;
}
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
JERRY_UNUSED (object_p);
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
} /* ecma_property_hashmap_create */
/**
@@ -220,22 +198,19 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
void
ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */
{
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
/* Property hash must be exists and must be the first property. */
ecma_property_header_t *property_p = ecma_get_property_list (object_p);
JERRY_ASSERT (object_p->u1.property_list_cp != JMEM_CP_NULL);
JERRY_ASSERT (property_p != NULL
&& ECMA_PROPERTY_GET_TYPE (property_p->types + 0) == ECMA_PROPERTY_TYPE_HASHMAP);
ecma_property_header_t *property_p =
ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, object_p->u1.property_list_cp);
JERRY_ASSERT (property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP);
ecma_property_hashmap_t *hashmap_p = (ecma_property_hashmap_t *) property_p;
object_p->property_list_or_bound_object_cp = property_p->next_property_cp;
object_p->u1.property_list_cp = property_p->next_property_cp;
jmem_heap_free_block (hashmap_p,
ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
JERRY_UNUSED (object_p);
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
jmem_heap_free_block (hashmap_p, ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));
} /* ecma_property_hashmap_free */
/**
@@ -247,11 +222,12 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
ecma_property_pair_t *property_pair_p, /**< property pair */
int property_index) /**< property index in the pair (0 or 1) */
{
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t,
object_p->property_list_or_bound_object_cp);
JERRY_ASSERT (property_pair_p != NULL);
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (hashmap_p->header.types + 0) == ECMA_PROPERTY_TYPE_HASHMAP);
ecma_property_hashmap_t *hashmap_p =
ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, object_p->u1.property_list_cp);
JERRY_ASSERT (hashmap_p->header.types[0] == ECMA_PROPERTY_TYPE_HASHMAP);
/* The NULLs are reduced below 1/8 of the hashmap. */
if (hashmap_p->null_count < (hashmap_p->max_property_count >> 3))
@@ -263,18 +239,10 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
JERRY_ASSERT (property_index < ECMA_PROPERTY_PAIR_ITEM_COUNT);
uint32_t entry_index = name_p->hash;
uint32_t entry_index = ecma_string_hash (name_p);
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
uint32_t mask = hashmap_p->max_property_count - 1;
if (mask < LIT_STRING_HASH_LIMIT)
{
entry_index &= mask;
}
else
{
entry_index <<= hashmap_p->header.types[1].type_and_flags;
}
entry_index &= mask;
#ifndef JERRY_NDEBUG
/* See the comment for this variable in ecma_property_hashmap_create. */
@@ -292,7 +260,7 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
#endif /* !JERRY_NDEBUG */
}
ECMA_SET_POINTER (pair_list_p[entry_index], property_pair_p);
ECMA_SET_NON_NULL_POINTER (pair_list_p[entry_index], property_pair_p);
uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);
bits_p += (entry_index >> 3);
@@ -306,6 +274,9 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
JERRY_ASSERT (hashmap_p->null_count > 0);
}
hashmap_p->unused_count--;
JERRY_ASSERT (hashmap_p->unused_count > 0);
if (property_index == 0)
{
*bits_p = (uint8_t) ((*bits_p) & ~mask);
@@ -314,43 +285,39 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
{
*bits_p = (uint8_t) ((*bits_p) | mask);
}
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
JERRY_UNUSED (object_p);
JERRY_UNUSED (name_p);
JERRY_UNUSED (property_pair_p);
JERRY_UNUSED (property_index);
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
} /* ecma_property_hashmap_insert */
/**
* Delete named property from the hashmap.
*
* @return ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP if hashmap should be recreated
* ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP otherwise
*/
void
ecma_property_hashmap_delete_status
ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
ecma_string_t *name_p, /**< name of the property */
jmem_cpointer_t name_cp, /**< property name */
ecma_property_t *property_p) /**< property */
{
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t,
object_p->property_list_or_bound_object_cp);
ecma_property_hashmap_t *hashmap_p =
ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, object_p->u1.property_list_cp);
JERRY_ASSERT (ECMA_PROPERTY_GET_TYPE (hashmap_p->header.types + 0) == ECMA_PROPERTY_TYPE_HASHMAP);
JERRY_ASSERT (hashmap_p->header.types[0] == ECMA_PROPERTY_TYPE_HASHMAP);
uint32_t entry_index = name_p->hash;
hashmap_p->unused_count++;
/* The NULLs are above 3/4 of the hashmap. */
if (hashmap_p->unused_count > ((hashmap_p->max_property_count * 3) >> 2))
{
return ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP;
}
uint32_t entry_index = ecma_string_get_property_name_hash (*property_p, name_cp);
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
uint32_t mask = hashmap_p->max_property_count - 1;
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);
if (mask < LIT_STRING_HASH_LIMIT)
{
entry_index &= mask;
}
else
{
entry_index <<= hashmap_p->header.types[1].type_and_flags;
JERRY_ASSERT (entry_index <= mask);
}
entry_index &= mask;
#ifndef JERRY_NDEBUG
/* See the comment for this variable in ecma_property_hashmap_create. */
@@ -362,23 +329,22 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
if (pair_list_p[entry_index] != ECMA_NULL_POINTER)
{
size_t offset = 0;
if (ECMA_PROPERTY_HASHMAP_GET_BIT (bits_p, entry_index))
{
offset = 1;
}
ecma_property_pair_t *property_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t,
pair_list_p[entry_index]);
ecma_property_pair_t *property_pair_p =
ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]);
if ((property_pair_p->header.types + offset) == property_p)
{
JERRY_ASSERT (ecma_compare_ecma_strings (ECMA_GET_NON_NULL_POINTER (ecma_string_t,
property_pair_p->names_cp[offset]),
name_p));
JERRY_ASSERT (property_pair_p->names_cp[offset] == name_cp);
pair_list_p[entry_index] = ECMA_NULL_POINTER;
ECMA_PROPERTY_HASHMAP_SET_BIT (bits_p, entry_index);
return;
return ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP;
}
}
else
@@ -393,14 +359,8 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
JERRY_ASSERT (entry_index != start_entry_index);
#endif /* !JERRY_NDEBUG */
}
#else /* CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
JERRY_UNUSED (object_p);
JERRY_UNUSED (name_p);
JERRY_UNUSED (property_p);
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
} /* ecma_property_hashmap_delete */
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
/**
* Find a named property.
*
@@ -409,7 +369,7 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
ecma_property_t *
ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
ecma_string_t *name_p, /**< property name */
ecma_string_t **property_real_name_p) /**< [out] property real name */
jmem_cpointer_t *property_real_name_cp) /**< [out] property real name */
{
#ifndef JERRY_NDEBUG
/* A sanity check in debug mode: a named property must be present
@@ -417,56 +377,101 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
* from both data collection. The following code checks the property
* chain, and sets the property_found variable. */
bool property_found = false;
ecma_property_header_t *prop_iter_p = ECMA_GET_POINTER (ecma_property_header_t,
hashmap_p->header.next_property_cp);
while (prop_iter_p != NULL && !property_found)
jmem_cpointer_t prop_iter_cp = hashmap_p->header.next_property_cp;
while (prop_iter_cp != JMEM_CP_NULL && !property_found)
{
ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));
ecma_property_pair_t *prop_pair_p = (ecma_property_pair_t *) prop_iter_p;
for (int i = 0; i < ECMA_PROPERTY_PAIR_ITEM_COUNT; i++)
{
if (prop_pair_p->names_cp[i] != ECMA_NULL_POINTER)
if (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[i]))
{
ecma_string_t *property_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t,
prop_pair_p->names_cp[i]);
if (ecma_compare_ecma_strings (name_p, property_name_p))
if (ecma_string_compare_to_property_name (prop_iter_p->types[i], prop_pair_p->names_cp[i], name_p))
{
/* Property is found */
property_found = true;
break;
}
}
}
prop_iter_p = ECMA_GET_POINTER (ecma_property_header_t,
prop_iter_p->next_property_cp);
prop_iter_cp = prop_iter_p->next_property_cp;
}
#endif /* !JERRY_NDEBUG */
uint32_t entry_index = name_p->hash;
uint32_t entry_index = ecma_string_hash (name_p);
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
uint32_t mask = hashmap_p->max_property_count - 1;
jmem_cpointer_t *pair_list_p = (jmem_cpointer_t *) (hashmap_p + 1);
uint8_t *bits_p = (uint8_t *) (pair_list_p + hashmap_p->max_property_count);
if (mask < LIT_STRING_HASH_LIMIT)
{
entry_index &= mask;
}
else
{
entry_index <<= hashmap_p->header.types[1].type_and_flags;
JERRY_ASSERT (entry_index <= mask);
}
entry_index &= mask;
#ifndef JERRY_NDEBUG
/* See the comment for this variable in ecma_property_hashmap_create. */
uint32_t start_entry_index = entry_index;
#endif /* !JERRY_NDEBUG */
if (ECMA_IS_DIRECT_STRING (name_p))
{
ecma_property_t prop_name_type = (ecma_property_t) ECMA_GET_DIRECT_STRING_TYPE (name_p);
jmem_cpointer_t property_name_cp = (jmem_cpointer_t) ECMA_GET_DIRECT_STRING_VALUE (name_p);
JERRY_ASSERT (prop_name_type > 0);
while (true)
{
if (pair_list_p[entry_index] != ECMA_NULL_POINTER)
{
size_t offset = 0;
if (ECMA_PROPERTY_HASHMAP_GET_BIT (bits_p, entry_index))
{
offset = 1;
}
ecma_property_pair_t *property_pair_p =
ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]);
ecma_property_t *property_p = property_pair_p->header.types + offset;
JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*property_p));
if (property_pair_p->names_cp[offset] == property_name_cp
&& ECMA_PROPERTY_GET_NAME_TYPE (*property_p) == prop_name_type)
{
#ifndef JERRY_NDEBUG
JERRY_ASSERT (property_found);
#endif /* !JERRY_NDEBUG */
*property_real_name_cp = property_name_cp;
return property_p;
}
}
else
{
if (!ECMA_PROPERTY_HASHMAP_GET_BIT (bits_p, entry_index))
{
#ifndef JERRY_NDEBUG
JERRY_ASSERT (!property_found);
#endif /* !JERRY_NDEBUG */
return NULL;
}
/* Otherwise it is a deleted entry. */
}
entry_index = (entry_index + step) & mask;
#ifndef JERRY_NDEBUG
JERRY_ASSERT (entry_index != start_entry_index);
#endif /* !JERRY_NDEBUG */
}
}
while (true)
{
if (pair_list_p[entry_index] != ECMA_NULL_POINTER)
@@ -477,19 +482,26 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
offset = 1;
}
ecma_property_pair_t *property_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t,
pair_list_p[entry_index]);
ecma_property_pair_t *property_pair_p =
ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]);
ecma_string_t *property_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t,
property_pair_p->names_cp[offset]);
ecma_property_t *property_p = property_pair_p->header.types + offset;
if (ecma_compare_ecma_strings (name_p, property_name_p))
JERRY_ASSERT (ECMA_PROPERTY_IS_NAMED_PROPERTY (*property_p));
if (ECMA_PROPERTY_GET_NAME_TYPE (*property_p) == ECMA_DIRECT_STRING_PTR)
{
ecma_string_t *prop_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t, property_pair_p->names_cp[offset]);
if (ecma_compare_ecma_non_direct_strings (prop_name_p, name_p))
{
#ifndef JERRY_NDEBUG
JERRY_ASSERT (property_found);
JERRY_ASSERT (property_found);
#endif /* !JERRY_NDEBUG */
*property_real_name_p = property_name_p;
return property_pair_p->header.types + offset;
*property_real_name_cp = property_pair_p->names_cp[offset];
return property_p;
}
}
}
else
@@ -499,6 +511,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
#ifndef JERRY_NDEBUG
JERRY_ASSERT (!property_found);
#endif /* !JERRY_NDEBUG */
return NULL;
}
/* Otherwise it is a deleted entry. */
@@ -511,7 +524,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
#endif /* !JERRY_NDEBUG */
}
} /* ecma_property_hashmap_find */
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
#endif /* JERRY_PROPERTY_HASHMAP */
/**
* @}
+28 -9
View File
@@ -1,5 +1,4 @@
/* Copyright 2016 Samsung Electronics Co., Ltd.
* Copyright 2016 University of Szeged.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +16,8 @@
#ifndef ECMA_PROPERTY_HASHMAP_H
#define ECMA_PROPERTY_HASHMAP_H
#include "ecma-globals.h"
/** \addtogroup ecma ECMA
* @{
*
@@ -37,6 +38,7 @@ typedef struct
ecma_property_header_t header; /**< header of the property */
uint32_t max_property_count; /**< maximum property count (power of 2) */
uint32_t null_count; /**< number of NULLs in the map */
uint32_t unused_count; /**< number of unused entries in the map */
/*
* The hash is followed by max_property_count ecma_cpointer_t
@@ -53,14 +55,31 @@ typedef struct
*/
} ecma_property_hashmap_t;
extern void ecma_property_hashmap_create (ecma_object_t *);
extern void ecma_property_hashmap_free (ecma_object_t *);
extern void ecma_property_hashmap_insert (ecma_object_t *, ecma_string_t *, ecma_property_pair_t *, int);
extern void ecma_property_hashmap_delete (ecma_object_t *, ecma_string_t *, ecma_property_t *);
#if JERRY_PROPERTY_HASHMAP
#ifndef CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
extern ecma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *, ecma_string_t *, ecma_string_t **);
#endif /* !CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE */
/**
* Simple ecma values
*/
typedef enum
{
ECMA_PROPERTY_HASHMAP_DELETE_NO_HASHMAP, /**< object has no hashmap */
ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP, /**< object has hashmap */
ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP, /**< hashmap should be recreated */
} ecma_property_hashmap_delete_status;
void ecma_property_hashmap_create (ecma_object_t *object_p);
void ecma_property_hashmap_free (ecma_object_t *object_p);
void ecma_property_hashmap_insert (ecma_object_t *object_p,
ecma_string_t *name_p,
ecma_property_pair_t *property_pair_p,
int property_index);
ecma_property_hashmap_delete_status
ecma_property_hashmap_delete (ecma_object_t *object_p, jmem_cpointer_t name_cp, ecma_property_t *property_p);
ecma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p,
ecma_string_t *name_p,
jmem_cpointer_t *property_real_name_cp);
#endif /* JERRY_PROPERTY_HASHMAP */
/**
* @}
@@ -0,0 +1,33 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
#include "jrt.h"
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-aggregateerror-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID aggregate_error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
@@ -0,0 +1,34 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* AggregateError.prototype built-in description
*/
#include "ecma-builtin-helpers-macro-defines.inc.h"
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.7.8 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_AGGREGATE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.9 */
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.10 */
STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -0,0 +1,109 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-iterator-object.h"
#include "ecma-objects.h"
#include "jcontext.h"
#include "jrt.h"
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-aggregateerror.inc.h"
#define BUILTIN_UNDERSCORED_ID aggregate_error
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmabuiltins
* @{
*
* \addtogroup aggregateerror ECMA AggregateError object built-in
* @{
*/
/**
* Handle calling [[Call]] of built-in AggregateError object
*
* @return ecma value
*/
ecma_value_t
ecma_builtin_aggregate_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
ecma_value_t message_val = ECMA_VALUE_UNDEFINED;
ecma_value_t error_val = ECMA_VALUE_UNDEFINED;
if (arguments_list_len > 0)
{
error_val = arguments_list_p[0];
if (arguments_list_len > 1)
{
message_val = arguments_list_p[1];
}
}
return ecma_new_aggregate_error (error_val, message_val);
} /* ecma_builtin_aggregate_error_dispatch_call */
/**
* Handle calling [[Construct]] of built-in AggregateError object
*
* @return ecma value
*/
ecma_value_t
ecma_builtin_aggregate_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE);
if (proto_p == NULL)
{
return ECMA_VALUE_ERROR;
}
ecma_value_t result = ecma_builtin_aggregate_error_dispatch_call (arguments_list_p, arguments_list_len);
if (!ECMA_IS_VALUE_ERROR (result))
{
ecma_object_t *object_p = ecma_get_object_from_value (result);
ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);
}
ecma_deref_object (proto_p);
return result;
} /* ecma_builtin_aggregate_error_dispatch_construct */
/**
* @}
* @}
* @}
*/
@@ -0,0 +1,35 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* AggregateError built-in description
*/
#include "ecma-builtin-helpers-macro-defines.inc.h"
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -0,0 +1,224 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-arraybuffer-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-iterator-object.h"
#include "ecma-typedarray-object.h"
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
/**
* This object has a custom dispatch function.
*/
#define BUILTIN_CUSTOM_DISPATCH
/**
* List of built-in routine identifiers.
*/
enum
{
ECMA_ARRAY_ITERATOR_PROTOTYPE_ROUTINE_START = 0,
ECMA_ARRAY_ITERATOR_PROTOTYPE_OBJECT_NEXT,
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-iterator-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID array_iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
* @{
*
* \addtogroup ecmabuiltins
* @{
*
* \addtogroup %arrayiteratorprototype% ECMA %ArrayIteratorPrototype% object built-in
* @{
*/
/**
* The %ArrayIteratorPrototype% object's 'next' routine
*
* See also:
* ECMA-262 v6, 22.1.5.2.1
*
* Note:
* Returned value must be freed with ecma_free_value.
*
* @return iterator result object, if success
* error - otherwise
*/
static ecma_value_t
ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< this argument */
{
/* 1 - 2. */
if (!ecma_is_value_object (this_val))
{
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
}
ecma_object_t *obj_p = ecma_get_object_from_value (this_val);
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
/* 3. */
if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_ITERATOR))
{
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR);
}
ecma_value_t iterated_value = ext_obj_p->u.cls.u3.iterated_value;
/* 4 - 5 */
if (ecma_is_value_empty (iterated_value))
{
return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);
}
ecma_object_t *array_object_p = ecma_get_object_from_value (iterated_value);
/* 8. */
ecma_length_t length;
if (ecma_object_is_typedarray (array_object_p))
{
/* a. */
ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (array_object_p);
if (ecma_arraybuffer_is_detached (arraybuffer_p))
{
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
}
/* b. */
length = ecma_typedarray_get_length (array_object_p);
}
else
{
ecma_value_t len_value = ecma_op_object_get_length (array_object_p, &length);
if (ECMA_IS_VALUE_ERROR (len_value))
{
return len_value;
}
}
ecma_length_t index = ext_obj_p->u.cls.u2.iterator_index;
if (JERRY_UNLIKELY (index == ECMA_ITERATOR_INDEX_LIMIT))
{
/* After the ECMA_ITERATOR_INDEX_LIMIT limit is reached the [[%Iterator%NextIndex]]
property is stored as an internal property */
ecma_string_t *prop_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX);
ecma_value_t index_value = ecma_op_object_get (obj_p, prop_name_p);
if (!ecma_is_value_undefined (index_value))
{
index = (ecma_length_t) (ecma_get_number_from_value (index_value) + 1);
}
ecma_value_t put_result = ecma_op_object_put (obj_p, prop_name_p, ecma_make_length_value (index), true);
JERRY_ASSERT (ecma_is_value_true (put_result));
ecma_free_value (index_value);
}
else
{
/* 11. */
ext_obj_p->u.cls.u2.iterator_index++;
}
if (index >= length)
{
ext_obj_p->u.cls.u3.iterated_value = ECMA_VALUE_EMPTY;
return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);
}
/* 7. */
uint8_t iterator_kind = ext_obj_p->u.cls.u1.iterator_kind;
if (iterator_kind == ECMA_ITERATOR_KEYS)
{
/* 12. */
return ecma_create_iter_result_object (ecma_make_length_value (index), ECMA_VALUE_FALSE);
}
/* 14. */
ecma_value_t get_value = ecma_op_object_get_by_index (array_object_p, index);
/* 15. */
if (ECMA_IS_VALUE_ERROR (get_value))
{
return get_value;
}
ecma_value_t result;
/* 16. */
if (iterator_kind == ECMA_ITERATOR_VALUES)
{
result = ecma_create_iter_result_object (get_value, ECMA_VALUE_FALSE);
}
else
{
/* 17.a */
JERRY_ASSERT (iterator_kind == ECMA_ITERATOR_ENTRIES);
/* 17.b */
ecma_value_t entry_array_value;
entry_array_value = ecma_create_array_from_iter_element (get_value, ecma_make_length_value (index));
result = ecma_create_iter_result_object (entry_array_value, ECMA_VALUE_FALSE);
ecma_free_value (entry_array_value);
}
ecma_free_value (get_value);
return result;
} /* ecma_builtin_array_iterator_prototype_object_next */
/**
* Dispatcher of the built-in's routines
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_array_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
JERRY_UNUSED_2 (arguments_list_p, arguments_number);
switch (builtin_routine_id)
{
case ECMA_ARRAY_ITERATOR_PROTOTYPE_OBJECT_NEXT:
{
return ecma_builtin_array_iterator_prototype_object_next (this_arg);
}
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_array_iterator_prototype_dispatch_routine */
/**
* @}
* @}
* @}
*/
@@ -0,0 +1,28 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* %ArrayIteratorPrototype% built-in description
*/
#include "ecma-builtin-helpers-macro-defines.inc.h"
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_NEXT, ECMA_ARRAY_ITERATOR_PROTOTYPE_OBJECT_NEXT, 0, 0)
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -0,0 +1,24 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-prototype-unscopables.inc.h"
#define BUILTIN_UNDERSCORED_ID array_prototype_unscopables
#include "ecma-builtin-internal-routines-template.inc.h"
@@ -0,0 +1,44 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Array.prototype[@@unscopables] built-in description
*/
#include "ecma-builtin-helpers-macro-defines.inc.h"
SIMPLE_VALUE (LIT_MAGIC_STRING_AT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_COPY_WITHIN, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_ENTRIES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_FILL, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_FIND, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_FIND_INDEX, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_FLAT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_FLATMAP, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_INCLUDES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_KEYS, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
SIMPLE_VALUE (LIT_MAGIC_STRING_VALUES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
#include "ecma-builtin-helpers-macro-undefs.inc.h"
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
* Copyright 2015 University of Szeged.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,69 +17,69 @@
* Array.prototype built-in description
*/
#ifndef OBJECT_ID
# define OBJECT_ID(builtin_object_id)
#endif /* !OBJECT_ID */
#include "ecma-builtin-helpers-macro-defines.inc.h"
#ifndef OBJECT_VALUE
# define OBJECT_VALUE(name, obj_builtin_id, prop_attributes)
#endif /* !OBJECT_VALUE */
#ifndef NUMBER_VALUE
# define NUMBER_VALUE(name, number_value, prop_attributes)
#endif /* !NUMBER_VALUE */
#ifndef ROUTINE
# define ROUTINE(name, c_function_name, args_number, length_prop_value)
#endif /* !ROUTINE */
/* Object identifier */
OBJECT_ID (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE)
#if JERRY_BUILTIN_ARRAY
/* Object properties:
* (property name, object pointer getter) */
// 15.4.4.1
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
ECMA_BUILTIN_ID_ARRAY,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.4.4.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 22.1.3.31 */
OBJECT_VALUE (LIT_GLOBAL_SYMBOL_UNSCOPABLES,
ECMA_BUILTIN_ID_ARRAY_PROTOTYPE_UNSCOPABLES,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Number properties:
* (property name, object pointer getter) */
// 15.4.4
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
0,
ECMA_PROPERTY_FLAG_WRITABLE)
/* ECMA-262 v5, 15.4.4 */
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_WRITABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ecma_builtin_array_prototype_object_to_string, 0, 0)
ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ecma_builtin_array_prototype_object_to_locale_string, 0, 0)
ROUTINE (LIT_MAGIC_STRING_CONCAT, ecma_builtin_array_prototype_object_concat, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_JOIN, ecma_builtin_array_prototype_join, 1, 1)
ROUTINE (LIT_MAGIC_STRING_POP, ecma_builtin_array_prototype_object_pop, 0, 0)
ROUTINE (LIT_MAGIC_STRING_PUSH, ecma_builtin_array_prototype_object_push, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_REVERSE, ecma_builtin_array_prototype_object_reverse, 0, 0)
ROUTINE (LIT_MAGIC_STRING_SHIFT, ecma_builtin_array_prototype_object_shift, 0, 0)
ROUTINE (LIT_MAGIC_STRING_SLICE, ecma_builtin_array_prototype_object_slice, 2, 2)
ROUTINE (LIT_MAGIC_STRING_SORT, ecma_builtin_array_prototype_object_sort, 1, 1)
ROUTINE (LIT_MAGIC_STRING_SPLICE, ecma_builtin_array_prototype_object_splice, NON_FIXED, 2)
ROUTINE (LIT_MAGIC_STRING_UNSHIFT, ecma_builtin_array_prototype_object_unshift, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ecma_builtin_array_prototype_object_index_of, 2, 1)
ROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ecma_builtin_array_prototype_object_last_index_of, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_EVERY, ecma_builtin_array_prototype_object_every, 2, 1)
ROUTINE (LIT_MAGIC_STRING_SOME, ecma_builtin_array_prototype_object_some, 2, 1)
ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ecma_builtin_array_prototype_object_for_each, 2, 1)
ROUTINE (LIT_MAGIC_STRING_MAP, ecma_builtin_array_prototype_object_map, 2, 1)
ROUTINE (LIT_MAGIC_STRING_FILTER, ecma_builtin_array_prototype_object_filter, 2, 1)
ROUTINE (LIT_MAGIC_STRING_REDUCE, ecma_builtin_array_prototype_object_reduce, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_REDUCE_RIGHT_UL, ecma_builtin_array_prototype_object_reduce_right, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_ARRAY_PROTOTYPE_TO_LOCALE_STRING, 0, 0)
ROUTINE (LIT_MAGIC_STRING_CONCAT, ECMA_ARRAY_PROTOTYPE_CONCAT, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_JOIN, ECMA_ARRAY_PROTOTYPE_JOIN, 1, 1)
ROUTINE (LIT_MAGIC_STRING_POP, ECMA_ARRAY_PROTOTYPE_POP, 0, 0)
ROUTINE (LIT_MAGIC_STRING_PUSH, ECMA_ARRAY_PROTOTYPE_PUSH, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_REVERSE, ECMA_ARRAY_PROTOTYPE_REVERSE, 0, 0)
ROUTINE (LIT_MAGIC_STRING_SHIFT, ECMA_ARRAY_PROTOTYPE_SHIFT, 0, 0)
ROUTINE (LIT_MAGIC_STRING_SLICE, ECMA_ARRAY_PROTOTYPE_SLICE, 2, 2)
ROUTINE (LIT_MAGIC_STRING_SORT, ECMA_ARRAY_PROTOTYPE_SORT, 1, 1)
ROUTINE (LIT_MAGIC_STRING_AT, ECMA_ARRAY_PROTOTYPE_AT, 1, 1)
ROUTINE (LIT_MAGIC_STRING_SPLICE, ECMA_ARRAY_PROTOTYPE_SPLICE, NON_FIXED, 2)
ROUTINE (LIT_MAGIC_STRING_UNSHIFT, ECMA_ARRAY_PROTOTYPE_UNSHIFT, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ECMA_ARRAY_PROTOTYPE_INDEX_OF, 2, 1)
ROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ECMA_ARRAY_PROTOTYPE_LAST_INDEX_OF, NON_FIXED, 1)
/* Note these 3 routines must be in this order */
ROUTINE (LIT_MAGIC_STRING_EVERY, ECMA_ARRAY_PROTOTYPE_EVERY, 2, 1)
ROUTINE (LIT_MAGIC_STRING_SOME, ECMA_ARRAY_PROTOTYPE_SOME, 2, 1)
ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_ARRAY_PROTOTYPE_FOR_EACH, 2, 1)
ROUTINE (LIT_MAGIC_STRING_MAP, ECMA_ARRAY_PROTOTYPE_MAP, 2, 1)
ROUTINE (LIT_MAGIC_STRING_FILTER, ECMA_ARRAY_PROTOTYPE_FILTER, 2, 1)
/* Note these 2 routines must be in this order */
ROUTINE (LIT_MAGIC_STRING_REDUCE, ECMA_ARRAY_PROTOTYPE_REDUCE, 2, 1)
ROUTINE (LIT_MAGIC_STRING_REDUCE_RIGHT_UL, ECMA_ARRAY_PROTOTYPE_REDUCE_RIGHT, 2, 1)
ROUTINE (LIT_MAGIC_STRING_FIND, ECMA_ARRAY_PROTOTYPE_FIND, 2, 1)
ROUTINE (LIT_MAGIC_STRING_FIND_INDEX, ECMA_ARRAY_PROTOTYPE_FIND_INDEX, 2, 1)
ROUTINE (LIT_MAGIC_STRING_FILL, ECMA_ARRAY_PROTOTYPE_FILL, 3, 1)
ROUTINE (LIT_MAGIC_STRING_COPY_WITHIN, ECMA_ARRAY_PROTOTYPE_COPY_WITHIN, NON_FIXED, 2)
ROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_ARRAY_PROTOTYPE_ENTRIES, 0, 0)
ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_ARRAY_PROTOTYPE_KEYS, 0, 0)
ROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_ARRAY_PROTOTYPE_INCLUDES, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_FLAT, ECMA_ARRAY_PROTOTYPE_FLAT, 1, 0)
ROUTINE (LIT_MAGIC_STRING_FLATMAP, ECMA_ARRAY_PROTOTYPE_FLATMAP, 2, 1)
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES,
LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,
LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#undef OBJECT_ID
#undef SIMPLE_VALUE
#undef NUMBER_VALUE
#undef STRING_VALUE
#undef OBJECT_VALUE
#undef ROUTINE
#endif /* JERRY_BUILTIN_ARRAY */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
@@ -1,4 +1,4 @@
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,24 +14,45 @@
*/
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-iterator-object.h"
#include "ecma-objects.h"
#include "ecma-array-object.h"
#include "ecma-try-catch-macro.h"
#include "jcontext.h"
#include "jrt.h"
#ifndef CONFIG_DISABLE_ARRAY_BUILTIN
#if JERRY_BUILTIN_ARRAY
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
/**
* This object has a custom dispatch function.
*/
#define BUILTIN_CUSTOM_DISPATCH
/**
* List of built-in routine identifiers.
*/
enum
{
ECMA_ARRAY_ROUTINE_START = 0,
ECMA_ARRAY_ROUTINE_IS_ARRAY,
ECMA_ARRAY_ROUTINE_FROM,
ECMA_ARRAY_ROUTINE_OF,
ECMA_ARRAY_ROUTINE_SPECIES_GET
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array.inc.h"
#define BUILTIN_UNDERSCORED_ID array
#define BUILTIN_UNDERSCORED_ID array
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -45,66 +66,503 @@
*/
/**
* The Array object's 'isArray' routine
* The Array object's 'from' routine
*
* See also:
* ECMA-262 v5, 15.4.3.2
* ECMA-262 v6, 22.1.2.1
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_array_object_is_array (ecma_value_t this_arg, /**< 'this' argument */
ecma_value_t arg) /**< first argument */
ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */
const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
JERRY_UNUSED (this_arg);
ecma_simple_value_t is_array = ECMA_SIMPLE_VALUE_FALSE;
/* 1. */
ecma_value_t constructor = this_arg;
ecma_value_t call_this_arg = ECMA_VALUE_UNDEFINED;
ecma_value_t items = arguments_list_p[0];
ecma_value_t mapfn = (arguments_list_len > 1) ? arguments_list_p[1] : ECMA_VALUE_UNDEFINED;
if (ecma_is_value_object (arg))
/* 2. */
ecma_object_t *mapfn_obj_p = NULL;
/* 3. */
if (!ecma_is_value_undefined (mapfn))
{
ecma_object_t *obj_p = ecma_get_object_from_value (arg);
if (ecma_object_get_class_name (obj_p) == LIT_MAGIC_STRING_ARRAY_UL)
/* 3.a */
if (!ecma_op_is_callable (mapfn))
{
is_array = ECMA_SIMPLE_VALUE_TRUE;
return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);
}
/* 3.b */
if (arguments_list_len > 2)
{
call_this_arg = arguments_list_p[2];
}
/* 3.c */
mapfn_obj_p = ecma_get_object_from_value (mapfn);
}
/* 4. */
ecma_value_t using_iterator = ecma_op_get_method_by_symbol_id (items, LIT_GLOBAL_SYMBOL_ITERATOR);
/* 5. */
if (ECMA_IS_VALUE_ERROR (using_iterator))
{
return using_iterator;
}
ecma_value_t ret_value = ECMA_VALUE_ERROR;
/* 6. */
if (!ecma_is_value_undefined (using_iterator))
{
ecma_object_t *array_obj_p;
/* 6.a */
if (ecma_is_constructor (constructor))
{
ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor);
ecma_value_t array = ecma_op_function_construct (constructor_obj_p, constructor_obj_p, NULL, 0);
if (ecma_is_value_undefined (array) || ecma_is_value_null (array))
{
ecma_free_value (using_iterator);
return ecma_raise_type_error (ECMA_ERR_CANNOT_CONVERT_TO_OBJECT);
}
/* 6.c */
if (ECMA_IS_VALUE_ERROR (array))
{
ecma_free_value (using_iterator);
return array;
}
array_obj_p = ecma_get_object_from_value (array);
}
else
{
/* 6.b */
array_obj_p = ecma_op_new_array_object (0);
}
/* 6.d */
ecma_value_t next_method;
ecma_value_t iterator = ecma_op_get_iterator (items, using_iterator, &next_method);
ecma_free_value (using_iterator);
/* 6.e */
if (ECMA_IS_VALUE_ERROR (iterator))
{
ecma_deref_object (array_obj_p);
return iterator;
}
/* 6.f */
uint32_t k = 0;
/* 6.g */
while (true)
{
/* 6.g.ii */
ecma_value_t next = ecma_op_iterator_step (iterator, next_method);
/* 6.g.iii */
if (ECMA_IS_VALUE_ERROR (next))
{
goto iterator_cleanup;
}
/* 6.g.iii */
if (ecma_is_value_false (next))
{
/* 6.g.iv.1 */
ecma_value_t len_value = ecma_make_uint32_value (k);
ecma_value_t set_status =
ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true);
ecma_free_value (len_value);
/* 6.g.iv.2 */
if (ECMA_IS_VALUE_ERROR (set_status))
{
goto iterator_cleanup;
}
ecma_free_value (iterator);
ecma_free_value (next_method);
/* 6.g.iv.3 */
return ecma_make_object_value (array_obj_p);
}
/* 6.g.v */
ecma_value_t next_value = ecma_op_iterator_value (next);
ecma_free_value (next);
/* 6.g.vi */
if (ECMA_IS_VALUE_ERROR (next_value))
{
goto iterator_cleanup;
}
ecma_value_t mapped_value;
/* 6.g.vii */
if (mapfn_obj_p != NULL)
{
/* 6.g.vii.1 */
ecma_value_t args_p[2] = { next_value, ecma_make_uint32_value (k) };
/* 6.g.vii.3 */
mapped_value = ecma_op_function_call (mapfn_obj_p, call_this_arg, args_p, 2);
ecma_free_value (args_p[1]);
ecma_free_value (next_value);
/* 6.g.vii.2 */
if (ECMA_IS_VALUE_ERROR (mapped_value))
{
ecma_op_iterator_close (iterator);
goto iterator_cleanup;
}
}
else
{
/* 6.g.viii */
mapped_value = next_value;
}
/* 6.g.ix */
const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;
ecma_value_t set_status = ecma_builtin_helper_def_prop_by_index (array_obj_p, k, mapped_value, flags);
ecma_free_value (mapped_value);
/* 6.g.x */
if (ECMA_IS_VALUE_ERROR (set_status))
{
ecma_op_iterator_close (iterator);
goto iterator_cleanup;
}
/* 6.g.xi */
k++;
}
iterator_cleanup:
ecma_free_value (iterator);
ecma_free_value (next_method);
ecma_deref_object (array_obj_p);
return ret_value;
}
/* 8. */
ecma_value_t array_like = ecma_op_to_object (items);
/* 9. */
if (ECMA_IS_VALUE_ERROR (array_like))
{
return array_like;
}
ecma_object_t *array_like_obj_p = ecma_get_object_from_value (array_like);
/* 10. */
ecma_length_t len;
ecma_value_t len_value = ecma_op_object_get_length (array_like_obj_p, &len);
/* 11. */
if (ECMA_IS_VALUE_ERROR (len_value))
{
goto cleanup;
}
/* 12. */
ecma_object_t *array_obj_p;
/* 12.a */
if (ecma_is_constructor (constructor))
{
ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor);
len_value = ecma_make_length_value (len);
ecma_value_t array = ecma_op_function_construct (constructor_obj_p, constructor_obj_p, &len_value, 1);
ecma_free_value (len_value);
if (ecma_is_value_undefined (array) || ecma_is_value_null (array))
{
ecma_raise_type_error (ECMA_ERR_CANNOT_CONVERT_TO_OBJECT);
goto cleanup;
}
/* 14. */
if (ECMA_IS_VALUE_ERROR (array))
{
goto cleanup;
}
array_obj_p = ecma_get_object_from_value (array);
}
else
{
/* 13.a */
array_obj_p = ecma_op_new_array_object_from_length (len);
if (JERRY_UNLIKELY (array_obj_p == NULL))
{
goto cleanup;
}
}
return ecma_make_simple_value (is_array);
} /* ecma_builtin_array_object_is_array */
/* 15. */
ecma_length_t k = 0;
/* 16. */
while (k < len)
{
/* 16.b */
ecma_value_t k_value = ecma_op_object_get_by_index (array_like_obj_p, k);
/* 16.c */
if (ECMA_IS_VALUE_ERROR (k_value))
{
goto construct_cleanup;
}
ecma_value_t mapped_value;
/* 16.d */
if (mapfn_obj_p != NULL)
{
/* 16.d.i */
ecma_value_t args_p[2] = { k_value, ecma_make_length_value (k) };
mapped_value = ecma_op_function_call (mapfn_obj_p, call_this_arg, args_p, 2);
ecma_free_value (args_p[1]);
ecma_free_value (k_value);
/* 16.d.ii */
if (ECMA_IS_VALUE_ERROR (mapped_value))
{
goto construct_cleanup;
}
}
else
{
/* 16.e */
mapped_value = k_value;
}
/* 16.f */
const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;
ecma_value_t set_status = ecma_builtin_helper_def_prop_by_index (array_obj_p, k, mapped_value, flags);
ecma_free_value (mapped_value);
/* 16.g */
if (ECMA_IS_VALUE_ERROR (set_status))
{
goto construct_cleanup;
}
/* 16.h */
k++;
}
/* 17. */
len_value = ecma_make_length_value (k);
ecma_value_t set_status =
ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true);
ecma_free_value (len_value);
/* 18. */
if (ECMA_IS_VALUE_ERROR (set_status))
{
goto construct_cleanup;
}
/* 19. */
ecma_deref_object (array_like_obj_p);
return ecma_make_object_value (array_obj_p);
construct_cleanup:
ecma_deref_object (array_obj_p);
cleanup:
ecma_deref_object (array_like_obj_p);
return ret_value;
} /* ecma_builtin_array_object_from */
/**
* The Array object's 'of' routine
*
* See also:
* ECMA-262 v6, 22.1.2.3
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */
const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
if (!ecma_is_constructor (this_arg))
{
return ecma_op_new_array_object_from_buffer (arguments_list_p, arguments_list_len);
}
ecma_value_t len = ecma_make_uint32_value (arguments_list_len);
ecma_value_t ret_val =
ecma_op_function_construct (ecma_get_object_from_value (this_arg), ecma_get_object_from_value (this_arg), &len, 1);
if (ECMA_IS_VALUE_ERROR (ret_val))
{
ecma_free_value (len);
return ret_val;
}
uint32_t k = 0;
ecma_object_t *obj_p = ecma_get_object_from_value (ret_val);
const uint32_t prop_status_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;
while (k < arguments_list_len)
{
ecma_value_t define_status =
ecma_builtin_helper_def_prop_by_index (obj_p, k, arguments_list_p[k], prop_status_flags);
if (ECMA_IS_VALUE_ERROR (define_status))
{
ecma_free_value (len);
ecma_deref_object (obj_p);
return define_status;
}
k++;
}
ret_val = ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len, true);
ecma_free_value (len);
if (ECMA_IS_VALUE_ERROR (ret_val))
{
ecma_deref_object (obj_p);
return ret_val;
}
return ecma_make_object_value (obj_p);
} /* ecma_builtin_array_object_of */
/**
* Handle calling [[Call]] of built-in Array object
*
* @return ecma value
* @return ECMA_VALUE_ERROR - if the array construction fails
* constructed array object - otherwise
*/
ecma_value_t
ecma_builtin_array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
ecma_length_t arguments_list_len) /**< number of arguments */
uint32_t arguments_list_len) /**< number of arguments */
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
return ecma_builtin_array_dispatch_construct (arguments_list_p, arguments_list_len);
if (arguments_list_len != 1 || !ecma_is_value_number (arguments_list_p[0]))
{
return ecma_op_new_array_object_from_buffer (arguments_list_p, arguments_list_len);
}
ecma_number_t num = ecma_get_number_from_value (arguments_list_p[0]);
uint32_t num_uint32 = ecma_number_to_uint32 (num);
if (num != ((ecma_number_t) num_uint32))
{
return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);
}
return ecma_make_object_value (ecma_op_new_array_object (num_uint32));
} /* ecma_builtin_array_dispatch_call */
/**
* Handle calling [[Construct]] of built-in Array object
*
* @return ecma value
* @return ECMA_VALUE_ERROR - if the array construction fails
* constructed array object - otherwise
*/
ecma_value_t
ecma_builtin_array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
ecma_length_t arguments_list_len) /**< number of arguments */
uint32_t arguments_list_len) /**< number of arguments */
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
return ecma_op_create_array_object (arguments_list_p, arguments_list_len, true);
ecma_object_t *proto_p =
ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);
if (proto_p == NULL)
{
return ECMA_VALUE_ERROR;
}
ecma_value_t result = ecma_builtin_array_dispatch_call (arguments_list_p, arguments_list_len);
if (ECMA_IS_VALUE_ERROR (result))
{
ecma_deref_object (proto_p);
return result;
}
ecma_object_t *object_p = ecma_get_object_from_value (result);
ECMA_SET_NON_NULL_POINTER (object_p->u2.prototype_cp, proto_p);
ecma_deref_object (proto_p);
return result;
} /* ecma_builtin_array_dispatch_construct */
/**
* Dispatcher of the built-in's routines
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_array_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
JERRY_UNUSED (arguments_number);
switch (builtin_routine_id)
{
case ECMA_ARRAY_ROUTINE_IS_ARRAY:
{
JERRY_UNUSED (this_arg);
return ecma_is_value_array (arguments_list_p[0]);
}
case ECMA_ARRAY_ROUTINE_FROM:
{
return ecma_builtin_array_object_from (this_arg, arguments_list_p, arguments_number);
}
case ECMA_ARRAY_ROUTINE_OF:
{
return ecma_builtin_array_object_of (this_arg, arguments_list_p, arguments_number);
}
case ECMA_ARRAY_ROUTINE_SPECIES_GET:
{
return ecma_copy_value (this_arg);
}
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_array_dispatch_routine */
/**
* @}
* @}
* @}
*/
#endif /* !CONFIG_DISABLE_ARRAY_BUILTIN */
#endif /* JERRY_BUILTIN_ARRAY */
@@ -1,4 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,49 +17,31 @@
* Array description
*/
#ifndef OBJECT_ID
# define OBJECT_ID(builtin_object_id)
#endif /* !OBJECT_ID */
#include "ecma-builtin-helpers-macro-defines.inc.h"
#ifndef OBJECT_VALUE
# define OBJECT_VALUE(name, obj_builtin_id, prop_attributes)
#endif /* !OBJECT_VALUE */
#ifndef NUMBER_VALUE
# define NUMBER_VALUE(name, number_value, prop_attributes)
#endif /* !NUMBER_VALUE */
#ifndef ROUTINE
# define ROUTINE(name, c_function_name, args_number, length_prop_value)
#endif /* !ROUTINE */
/* Object identifier */
OBJECT_ID (ECMA_BUILTIN_ID_ARRAY)
#if JERRY_BUILTIN_ARRAY
/* Object properties:
* (property name, object pointer getter) */
// 15.4.3.1
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,
ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.4.3.1 */
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, ECMA_PROPERTY_FIXED)
/* Number properties:
* (property name, object pointer getter) */
// 15.4.3
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
1,
ECMA_PROPERTY_FIXED)
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ARRAY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_IS_ARRAY_UL, ecma_builtin_array_object_is_array, 1, 1)
ROUTINE (LIT_MAGIC_STRING_IS_ARRAY_UL, ECMA_ARRAY_ROUTINE_IS_ARRAY, 1, 1)
ROUTINE (LIT_MAGIC_STRING_FROM, ECMA_ARRAY_ROUTINE_FROM, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_OF, ECMA_ARRAY_ROUTINE_OF, NON_FIXED, 0)
#undef OBJECT_ID
#undef SIMPLE_VALUE
#undef NUMBER_VALUE
#undef STRING_VALUE
#undef OBJECT_VALUE
#undef ROUTINE
/* ECMA-262 v6, 22.1.2.5 */
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ECMA_ARRAY_ROUTINE_SPECIES_GET, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* !(JERRY_BUILTIN_ARRAY) */
#include "ecma-builtin-helpers-macro-undefs.inc.h"

Some files were not shown because too many files have changed in this diff Show More