127 Commits

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