217 Commits

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