Indenting preprocessor directives reduces the code readability, because it make preprocessor directives harder to spot.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
`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
A lot of warnings remained hibben because 'EXTRACT_ALL' was previously set to YES.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
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
* Resolve linker errors with -O0 in some compilers
* Reduce the stack usage
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Direct strings are a new type of direct ecma-values (no memory allocation
is needed for encoding them) in JerryScript. Currently magic strings,
external magic strings and uint values are encoded as direct strings.
The constant pool of JerryScript byte-code is changed to hold ecma-values
rather than cpointers to support direct strings.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This patch removes all ecma_make_simple_value calls to make the code more easy to understand.
Also removes the type ecma_simple_value_t which improves the performance in related code paths by calculating the value of new ecma_value_t is no longer needed.
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
Furthermore the maximum number of properties is increased to 96.
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
This change allows easier access to array length which improves
the performance of inserting new items into an array and there
is no need to allocate length strings anymore. The trade-of is
that array length cannot be cached anymore.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Class and value internal properties are always exists for primitive
types (e.g. Boolean, Regex) so they can be stored right after the
object. This improve property access (since internal properties are
searched by a slow linear algorithm) and reduces memory consumption,
since only 8 byte is allocated for these two properties instead of
16 which is the size of a property pair.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Properties are changed to a type and value pair instead of a pointer to an internal
representation. Functions such as ecma_op_object_get_[own_]property do not
return with property pointers anymore.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
The ecma_op_object_get_[own_]property calls should be phased out from
the project eventually and virtual properties should be introduced instead.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Removing a lot of ECMA_PROPERTY_VALUE_PTR macro calls. The only drawback
is free callbacks for native objects cannot be deleted anymore. Redefining
a free callback is a rare case, so this trade-of is acceptable.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Until now, jerry had 3 different assert-like routines:
`jerry_assert_fail`, `jerry_unreachable`, and `jerry_unimplemented`,
and 3 corresponding macros (`JERRY_ASSERT`, `JERRY_UNREACHABLE`,
and `JERRY_UNIMPLEMENTED`). They had some irregularities, namely:
* All of them had a string parameter, although `jerry_unreachable`
never got anything there but NULL.
* Both `jerry_unreachable` and `jerry_unimplemented` checked its
string parameter for NULL, although it was always NULL for the
first one and never NULL for the second.
* `jerry_unreachable` is just a regular assert with a fixed error
message (i.e., control should not have got here), however, the
expansion of its corresponding macro in debug and release modes
differs from the behaviour of `JERRY_ASSERT`: `JERRY_ASSERT` is
a no-op in release, however, `JERRY_UNREACHABLE` was triggering
a crash even there.
* Moreover, `JERRY_UNIMPLEMENTED` was almost never used anymore but
in a few places (where often an `#ifdef` selected between
`JERRY_UNIMPLEMENTED` and `JERRY_UNREACHABLE`).
Because of the above, this patch makes the following changes:
* Drops `JERRY_UNIMPLEMENTED` completely and whereever it was still
used, replaces it with `JERRY_UNREACHABLE`. As a consequence, the
`jerry_unimplemented` function and the `ERR_UNIMPLEMENTED_CASE`
fatal error code are also removed.
* Makes `JERRY_UNREACHABLE` expand to no-op in release builds.
(Actually, to `__builtin_unreachable ()` to avoid warnings.) As
a consequence, makes both `jerry_assert_fail` and
`jerry_unreachable` be guarded by `#ifndef JERRY_NDEBUG`. Also,
changes `jerry_unreachable` not to expect a string parameter.
* Rewrites `TEST_ASSERT` not to rely on `jerry_assert_fail` as
`TEST_ASSERT` has to work in release builds as well. This also
allows changing the error message not to mention "ICE", which
would misleadingly suggest an assert within the engine, but
"TEST" instead.
As a side-effect of the cleanup, some refactorings happened in
jrt.h:
* Removed the definition of the unnecessary `__extension__` macro.
* Re-used `JERRY_UNUSED` and `unlikely` where possible.
* Moved some parts of the file around.
* Fixed some comments (`/**` should only be used for the docstring
of a single entity, for groups header comments, the regular `/*`
should be used).
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
The standard doesn't defines ECMAScript Compact Profile as a subset of Ecma-262 Edition 5.1.
Profile modes can be added easily like the minimal profile if required.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@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
The "length" property name is the most frequently used built-in string
and also frequently created by various hot-paths. New functions are
added to improve the speed of the "length" string creation.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Several internal properties are removed and directly stored as
part of the object. Faster built-in and JS function processing.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
the three boolean arguments of ecma_create_named_data_property and the
two boolean arguments of ecma_create_named_accessor_property are combined
into one uint8_t argument. On ARM-32 it is preferred to have less than
four arguments, since these arguments can be passed in registers.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
String, Boolean) to use ecma-values. When the value of a Number object is
a small integer number, this change reduces the memory consumption, since no
double is allocated.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This modificiation affects those conditions which check that
a value can be represented with a smaller type.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This change affects only those internal properties which have a primitive value field.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
itself seems a step back, but the primary aim is opening future
optimization opportunities. The list of changes follows:
- Property is changed to be an abstract type, which has type, flags,
and a value. It does not have a name anymore and property pointers
cannot be compressed.
- Full (32 bit) ecma values can be property values. This allows
using non-compressed pointers for ecma values in the future.
- The property chain is not restricted to the same item anymore,
it can contain hash maps, arrays in the future.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
The positive side effect is that the maximum Jerry memory is increased to 512K.
Furthermore a slight (1.3%) performance improvement was measured on RPi2 with
SunSpider.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
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
Avoid sorting the array of property magic string IDs and make it
const, thus ensuring that it gets placed in .rodata. Replace the
binary search in the array (which would not work anymore because
of unsortendness) with function that returns the index of the
looked-after magic string ID using a switch-based logic (we rely
on compiler optimization to generate optimal code from that
switch).
Extras:
* Getting rid of the superfluous macro argument from routine names.
* Fixing the list of undef'd macros
* Fixing related comments
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Remove ecma_completion_value_t, and add an extra bit to
ecma_value_t to represent errors. From the long list of
completion types only normal and error remained.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com