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
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
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
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
- 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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
`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
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
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
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
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
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
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
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
Zero out all globals (and remove unnecessary init() functions).
Move snapshot globals to a temporary stack variable.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
There have been several renamings of header files but the
ifndef/define/endif preprocessor directives did not always follow
the file name changes (or perhaps never followed a unified naming
scheme). This patch gets all headers aligned with the style of the
majority.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
E.g.,
* `ssize_t` was used where `lit_utf8_size_t` or `jerry_api_size_t`
would have been correct,
* `lit_utf8_size_t` was used where `ecma_length_t` would have been
correct.
Note, the patch also includes internal and public API changes:
* `ecma_string_to_utf8_string` does not return negative value if
output buffer is not large enough to contain the string; the
buffer is expected to be large enough. (`ecma_string_get_size`
can be used to retrieve the required size.)
* `jerry_api_string_to_char_buffer` adapts the same logic (and
`jerry_api_get_string_size` can be used to determine the
required size of the buffer).
Related issue: #942
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu