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
Various calls updated to use API from jerry-api.h (to-be JerryScript 1.0
API).
Use jerry_eval() instead of jerry_run_simple(), as it allow to store (and
then access) variables in a global environment. E.g. following now works
(entered and executed as two separate lines):
a = 1
print(a)
JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
* Removed jerry_string_t and jerry_object_t
* Updated function names
* Updated return values
* Updated function descriptions
* Added new functions
* Added new unittests
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Allocate a single memory block for strings, rather than a separate string header
and string characters block. In the past strings were split into 8 byte chunks,
and large amount of legacy code is designed for that representation. However the
current allocator allows block allocation so we don't need those complicated
algorithms anymore. This patch is a cleanup rather than an optimization.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Short summary of the changes:
- The ecma_reference_t is removed, and its helper functions are deleted.
- The delete operation does not depend on ecma_reference_t anymore.
- A new resolve function is added which returns the current value
of a named binding in the context chain.
- The vm_op_set_value does not perform type conversions when its arguments
has the appropriate types.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Signed left shift operations are undefined in C. Add constants for the minimum/maximum integer value which are already shifted. Technically, the constant for the shifted maximum value is not required, adding it for consistency/increased readability.
The bug was detected by -Wshift-negative-value both with GCC 6.x and Clang.
This fixes#1174.
JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
- Fixed problem when the x86 hangs waiting for the ARC to
be initialized. If you flash as arduino_101 instead of
arduino_101_factory this will happen and you will not get
a command line.
- Changed default build to arduino_101_factory which is
the current recommended method of flashing the arduino_101
- Updated documentation to explain a few bits on how to flash
the board and conform to the v1.4.0 way of flashing the device.
- Added a helper to run the dfu-util command directly on make.
JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
- DEVELOPMENT.md is extended with bash utilites.
- Internals doc added and DEVELOPMENT is renamed to GETTING-STARTED.
- modified image links in Internals
- links are fixed in README.md
JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
In Makefile.zephyr the SOURCE_DIR variable was introduced recently.
However, the SOURCE_DIR variable is heavily used in zephyr. If you try to build
the jerryscript zephyr port from a zephyr project using the makefiles, the
SOURCE_DIR gets set by the zephyr build system and points to wrong place here.
This patch creates unique name to avoid the name clash.
JerryScript-DCO-1.0-Signed-off-by: Sakari Poussa sakari.poussa@intel.com
Internal functions cannot handle error values, so it must be avoided to
pass error values to the engine.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Read the zephyr crosscompile settings earlier so correct values are used.
Currently, the crosscompilation does not work on OSX. With this fix it does.
JerryScript-DCO-1.0-Signed-off-by: Sakari Poussa sakari.poussa@intel.com
The new literal storage keeps ecma strings rather than having a
custom string implementation which duplicates the string management
routines. Conversions between string implementations are eliminated
which improved the performance by 4%.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Implemented 'jerry_is_array' and 'jerry_get_array_length' API functions.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
- Add preliminary support for ARC architecture.
Using "em_starterkit" board supported by Zephyr. Only build for this board
is tested, not booted on a real device due to lack of access. There's no
QEMU emulation support for ARC in Zephyr (yet) either.
- Update README to cover different Zephyr architectures/boards.
- Changed the arduino_101 paths to something more generic and adaptable
- Made sure it compiles and runs on Arduino 101
JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
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
Building with -std=c99 is not sufficient to enforce a pure C99 build as it still allows GNU extensions which don't conflict with C99 to be used. Add -pedantic to the build options to ensure that the codebase is only using C99 constructs and the build will fail whenever any compiler extension is used. This helps to ensure that JerryScript remains portable and can be built with any C99-compatible C compiler.
Removing -Wpedantic, as any warnings of that type will already trigger an error when building with -pedantic.
JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
The build fails with enabled ALL_ON_ONE and enabled COMPILER_DEFAULT_LIBC options,
because the _BSD_SOURCE doesn't defined before including the sys/time.h.
In case of glibc, the 'timezone' is not part of C99 but part of POSIX, so we need
to define the _BSD_SOURCE feature test macro before including sys/time.h to get
the prototype for this struct.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
The GCC 4.7 check is a leftover from the times when JerryScript was a C++11 codebase, it was there to ensure that JerryScript is compiled with a GCC version which has sufficient support for C++11.
Today JerryScript is a pure C99 codebase (enforced by building all the sources with -std=c99) and this check is no longer necessary. JerryScript should now build just fine even with rather old versions of GCC.
JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
There is no need for putting `LIT_CHAR_*` constants in const
scalars or arrays, they can be used directly. (There is especially
no need for arrays of 10 elements if only 2 of them are used.)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
* Make constants static in `ecma_number_to_utf8_string`.
* Make `ecma_number_to_utf8_string` use early returns, and rewrite
its self-recursion in case of negative numbers.
* Make the stringification of decimal exponent in
`ecma_number_to_utf8_string` use `ecma_uint32_to_utf8_string`.
* Changed ERROL0 dtoa implementation to use the `double` type
instead of `ecma_number_t`. Thus, even is `ecma_number_t` is 32
bit wide, the algorithm works the same.
* Changed `ecma_number_to_decimal` to use the ERROL0 dtoa algorithm
for 32-bit floats as well.
* Changed `ecma_number_to_decimal` to generate the decimal string
representation of the mantissa instead of an `uint64_t` number.
* Changed `ecma_number_to_utf8_string` to make use of the already
available string representation of the mantissa, generated now by
`ecma_number_to_decimal`.
* Changed `ecma_number_to_utf8_string` not to use static arrays and
variables for digit, "e", etc. generation.
* Changed all `Number.prototype.toXXX` implementations and the
`ecma_builtin_number_prototype_helper_round` helper to make use
of the already available string representation of the mantissa,
generated now by `ecma_number_to_decimal`.
* Factored out the common stringification parts of all
`Number.prototype.toXXX` implementations into a new helper
`ecma_builtin_number_prototype_helper_to_string`.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
* Fix error handling (related issue: #1141)
* Move output paramters to the end of the arguments lists
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
Changed 'ecma_copy_or_ref_ecma_string' to 'ecma_ref_ecma_string'. It does
not copy the string if the maximum number of reference counter is reached,
but bails out with an error like the 'ecma_ref_object' function does.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
When `val` is DBL_MAX, we get +inf from `ECMA_NEXT_FLOAT (val)`.
It is necessary to handle this case specially.
Related issue: #1054
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
This adds support for ARM/Thumb2 (Cortex-M) architecture, tested with
BOARD=qemu_cortex_m3 (i.e. QEMU with Cortex-M emulation). Should also
ease porting to other architectures supported by Zephyr.
This uses method of passing external libraries and link options into a
Zephyr application using ALL_LIBS and LDFLAGS_zephyr make variables, as
suggested by the Zephyr developers:
https://gerrit.zephyrproject.org/r/#/c/2476/ , and makes sure to append
to them, instead of assigning, to not overwrite important target-specific
options set by the Zephyr core.
JerryScript-DCO-1.0-Signed-off-by: Paul Sokolovsky paul.sokolovsky@linaro.org
Correct behaviour of step 8, 15.9.3.1, ECMA-262 v5.1.
- Change ToInt32(y) to ToInteger(y).
- If ToInteger(y) is not between 0 and 99 then yr = y
Related issue: #1071
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com