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
Now the following conventions are applied:
- passing the number of arguments for a function call is always uint32_t
- string size/length/position related operation should use lit_utf8_size_t
- Extended objects internal fields must be uint32_t
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This change includes several bugfixes, general improvements, and support
for additional features.
- Added full support for web compatibility syntax defined in Annex B
- Implemented parsing and matching patterns in unicode mode
- Fixed capture results when iterating with nested capturing groups
- Significantly reduced regexp bytecode size
- Reduced stack usage during regexp execution
- Improved matching performance
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
A large rework because surrogate pairs must be combined.
Currently only the 0x10C80..0x10CF2 is accepted as valid identifier character from the non-basic plane.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
- 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
`JERRY_UNREACHABLE`s often signal code structure that could be
improved: they can usually either be rewritten to `JERRY_ASSERT`s
or eliminated by restructuring loops, `if`s or `#if`s. Roughly,
the only valid occurences are in default cases of `switch`es. And
even they can often be merged into non-default cases.
Moreover, it is dangerous to write meaningful code after
`JERRY_UNREACHABLE` because it pretends as if there was a way to
recover from an impossible situation.
This patch rewrites/eliminates `JERRY_UNREACHABLE`s where possible
and removes misleading code from after them.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
In general, public headers should not have compiler-specific
constructs but both the core and the port headers have attributes,
which are non-standard. It's better to factor out such constructs
to a common place (a new header) and hide them behind macros, which
can then be defined on a per-compiler basis.
This patch moves the existing definitions of function attributes and
likely/unlikely builtins to the new header. At the same time, it
unifies the names of these attribute defines and where they are
used. Moreover, it touches on jerry-main and removes the uses of
`__attribute__((unused))` entirely and replaces them with the
elsewhere used `(void) ...` pattern.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Copy the characters of a string into a specified utf-8 string buffer.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
The JSON parser required a zero terminated writable copy of
the original string. The requirement is eliminated from the
project to reduce peak memory consumption.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.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
OS X build regularly reports some 39 warnings falling in 3 major
categories:
* "static function '...' is used in an inline function with
external linkage [-Wstatic-in-inline]": Some semantics around
`inline` have changed between C89 and C99, and gcc and clang seem
to disagree on how strict they should be about them. Solution
chosen is to use `-Wnostatic-in-inline` command line option for
clang.
* "implicit conversion turns floating-point number into integer:
'double' to 'bool' [-Wfloat-conversion]": `if (fmod (..., ...))`
was used at different places, which is not nice anyway, thus the
return value is compared explicitly against `ECMA_NUMBER_ZERO`.
* "format string is not a string literal [-Wformat-nonliteral]":
Console and log port I/O functions have a printf-like interface,
and the default implementations actually pass both format string
and the remaining arguments to a vfprintf. However, clang is
strict about the format string parameter of vfprintf and expects
a literal there. By annotating the port I/O functions with
`__attribute__ ((format (printf, ..., ...)))`, clang will check
the format string being a literal string earlier, when the port
functions are called, and will not complain within them when
vfprintf is called.
(Actually, this has revealed an incorrect format string, which
has been fixed as well.)
(There were also some single conversion errors not listed above.)
The patch was tested on OS X (where all warnings disappeared), but
it should help clang compilation on other OS's as well.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The internals have surprisingly large number of unused functions at
surprising places. This patch cleans them out to make maintenance
easier and to prevent dead code having effect on future decisions.
The patch intentionally does not try to clean up public API but
focuses on internal modules only that are/should not be reachable
from "outside".
However, unit tests do access private API, thus tests of literal
storage had to be adjusted.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Those macros are legacy and are not used consitently throughout the
code base. This patch eliminates their definitions and rewrites
their remaining occurrences to TODO comments.
All occurrences have been checked and made sure that the comments
used a consistent style.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Add another argument for the JERRY_STATIC_ASSERT with the description of the assert statement.
The release.linux build fails with enabled ALL_IN_ONE option.
There is no redefinition of typedef in C99.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
* Fix "end of file while inside a group" doxygen warnings.
* Fix "unknown command" doxygen warnings caused by incorrect
argument references. Instead of `@foo`, `@a foo` is the proper
format.
* Fix "unknown command" doxygen warnings caused by incorrect
parameter direction specifications. Instead of `@in`, `@out`,
and `@in-out`, `[in]`, `[out]`, and `[in,out]` are the proper
formats.
* Wrapping special characters in quotes to avoid doxygen
confusion. Raw pipe, semicolon, dot, backslash, etc. characters
can drive doxygen into various misinterpretations and warnings.
E.g.:
```
End of list marker found without any preceding list items
Found unknown command
```
Putting quotes around such text snipets eliminates the errors.
* Fix the documentation of `ecma_builtin_global_object_print`. Raw
<> and \ sequences confused doxygen in various ways (it tried to
interpret them as XML tags and doxygen commands).
* Fix "ignoring title that does not match old title" doxygen
warnings. At some places, the group titles were out of sync, at
others, the group names were incorrect.
* Fix "parameters are not documented" doxygen warnings. Fixing
various typos in the inline parameter documentations (`/*`,
`/**`, `/** <`, and `/**>` are all considered incorrect, the
right format is `/**<`).
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu