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
Parts:
* Rename ecma_string_to_utf8_string() to ecma_string_copy_to_utf8_buffer.
* Introduce ecma_string_to_utf8_bytes(), which wraps the usual 'function call-assertion' pair,
and check strict equality of size of the string and the buffer.
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
Skip put result phase for opcodes which put their
result onto the stack or they don't have result at all.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
The number of delete opcodes is reduced to two from six. The
range of numbers which can be included in the byte code is
doubled from (-127,127) to (-256,256).
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This patch contains an example in which you can run a small js on RIOT-OS with STM32F4-Discovery.
Check the README.md for a more detailed explanation of how to compile and run it.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
or no arguments at all. To improve the performance, the branch argument
flag is changed into a get argument type which eliminates a flag check
for all executed opcodes. Furthermore branch opcodes skip the put result
phase by changing the "break" to "continue" statements.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
* Rename 'jerry_api_' prefix to 'jerry_'
* Fix minor style issues
* Group the API functions and add comment to each group
* Move engine behaviour related funtions to 'jerry.h'
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
This patch contains a project in which you can run
a small js test inside the Arduino101.
Follows the Nuttx implementation to replicate a command
line in the Quark SE Lakemont architecture.
Everything is self contained in the targets/arduino_101 folder.
It has only been tested with the arduino 101 at the moment.
Check the README.md for a more detailed explanation of
how to compile and run it.
- Command line javascript run test.
Use test to get a default test.
Write any valid javascript in the shell and get it resolved and executed
- Support for qemu
- Added extra verbose mode on the demo function
- Support to build factory images that can be flashed with dfu-util
- Added a few extra examples on the README about commands that work.
Small fixes to readme and libc_support.c (#1)
- Added a few more instructions to the README.md for arduino_101
- Added the stdint.h include in libc_support.c
- Added parameter to check-vera.sh to check a specific folder
- Cleared the libc function duplication
JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
The implementation is simplified and optimized
resulting the removal a large amount of code.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
The cache stores only real properties now, because storing NULLs has
little benefit according to tests. Since only real properties are
stored now, there is no need to create real references to objects
and property names, which reduces the keeping of dead objects after
garbage collection.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
* Improve the name of the temporary snapshot files in test runner:
Until now, test runner used a completely random filename for the
temporary snapshot file when testing (saving to and executing from)
snapshots. This patch makes the temp file contain part of the name
of the original test file in order to make reading the logs (and
thus, identifying failing tests) easier.
* Add `--snapshot` to summary info of test runner if testing snapshot
support:
This helps reading the logs, especially when multiple tests run in
parallel and get their output mixed. E.g., on the CI, all tests
write the console at the same time and messages get interleaved.
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
Links to JerryScript API reference page (https://samsung.github.io/jerryscript/API/) are inserted.
JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu
Move the enclosed condition forward and combine the two if statements.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
The ecma_op_to_boolean return value is changed to bool for faster
evaluation, and no need to swap operandos of relational compare.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com