936 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
271d9b2463
Outsource magic error messages (#4821)
Modify tools/gen-magic-strings.py to generate error messages.

JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2021-11-25 14:06:40 +01:00
Robert Fancsik
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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