4220 Commits

Author SHA1 Message Date
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