2207 Commits

Author SHA1 Message Date
slaff
2ef89eafbf Added console message implementation for ESP8266. (#1398)
JerryScript-DCO-1.0-Signed-off-by: Slavey Karadzhov slaff@attachix.com
2016-10-19 12:56:09 +02:00
Zoltan Herczeg
3ce48be152 Improve array length setting. (#1393)
The new set does not allocate memory when the size of the array is reduced.
Furthermore the [[PutObject]] method directly calls the new length setter.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-10-19 16:45:17 +09:00
László Langó
a130059c8b Add error messages to ecam/operations. (#1396)
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-10-19 09:37:51 +09:00
Zoltan Herczeg
6af70e5899 Change string length into a virtual property. (#1395)
Reduces the memory consumption of String objects.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-10-18 11:11:00 +02:00
Robert Sipka
e8428383f1 Use 'ecma_make_boolean_value' where possible. (#1394)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-10-18 09:12:05 +02:00
Robert Sipka
42be0704b9 Added target to compile JerryScript beside Particle Device Firmware on Photon board. (#1391)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-10-17 20:54:08 +09:00
Sergio Abraham Martinez Rodriguez
535743412e [zephyr] Removed factory setting deprecated on zephyr (#1390)
The new zephyr build system doesn't support the arduino_101_factory
board.

This change restores the default BOARD to arduino_101 which
is the current recommended method.

If you are in an older SDK / Zephyr you can still use.

`make -f ./targets/zephyr/Makefile.zephyr BOARD=arduino_101_factory`

JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
2016-10-10 08:40:58 +02:00
Akos Kiss
9915307bc0 Drop -gdwarf-4 from compiler flags (#1385)
`-g` is enough (most modern compilers use DWARF4 as default, at
least, e.g., GCC has switched from DWARF2 in 4.8), more future
proof (if a compiler moves to a newer version, it wont get forced
to a fixed older version), and less restrictive (some compilers
handle the "standard" `-g` only but don't understand its variants).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-10-04 11:51:03 +02:00
Akos Kiss
37c28f694a Undef VALGRIND_*_SPACE macros at the end of sources (#1382)
Defining the same macros in multiple source files can cause macro
re-definition warnings or errors in all-in-one builds.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-30 09:03:25 +02:00
Akos Kiss
e16cc83ce7 Simplify the way libgcc is linked (#1380)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-30 09:02:42 +02:00
Daniel Thompson
8320a2cbc9 target: zephyr: Include toolchain headers using -isystem (#1381)
Currently the zephyr port fails to build with some cross-toolsets because
warnings from the system headers are being treated as errors. Using
-isystem for any includes in TOOLCHAIN_CFLAGS allows us to crank up the
warning levels without worrying about newlib headers breaking the build.

JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
2016-09-30 07:45:50 +02:00
Daniel Thompson
7584ce26c2 target: zephyr: Select compile options by ARCH rather than BOARD (#1374)
Currently we need to modify the JerryScript Makefiles for every new
board we want to work with. It is better to study the zephyr configuration
and used the CONFIG_ options to determine the right compiler flags.

We expose the CONFIG_ options to make by adding machinary to the makefiles
to import the Zephyr .config file, allow us to make the decisions we
need.

JerryScript-DCO-1.0-Signed-off-by: Daniel Thompson daniel.thompson@linaro.org
2016-09-29 23:34:13 +02:00
Akos Kiss
509407bfd4 Update jerry-libc unreachable asserts (#1379)
Newer compilers (especially clang) warn (and fail) on
`assert (!"message");` constructs typically used to assert on
unreachable code paths (multiple occurrences in jerry-libc). A more
up-to-date approach is to use `assert (false && "message");`. This
patch applies the pattern to all relevant asserts in jerry-libc.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-29 16:17:46 +02:00
Akos Kiss
e2aa714565 Improve the stdin handling of the command line tool (#1378)
This patch improves the command line tool in two ways:
* The tool can be instructed to read and execute a script from
  stdin by invoking it as `jerry -`.
* The tool can be instructed to suppress its prompt when in repl
  mode by invoking it as `jerry --no-prompt`.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-28 14:14:05 +02:00
Akos Kiss
9b5d0cc7ec Add IRC notification to Travis CI configuration (#1376)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-26 16:07:29 +02:00
Akos Kiss
e67078f5ca Revoke exec permission from non-scripts (#1377)
Several non-script files have been added with exec permission to
the repository. This patch revokes the erroneous permissions.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-26 08:27:29 +02:00
Zoltan Herczeg
0ad347b97f Improve define own property. (#1369)
This patch changes define own property to search a property only once.
Currently all existing properties are searched at least twice, sometimes
three times which is not optimal.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-23 10:06:36 +02:00
chokobole
547647af13 Type cast according to format string (#1368)
JerryScript-DCO-1.0-Signed-off-by: wonyong.kim wonyong.kim@samsung.com
2016-09-23 09:47:13 +02:00
Akos Kiss
40bed0f963 Fix compiler warnings in unit tests (#1373)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-22 15:48:14 +02:00
Akos Kiss
e4f27199d7 Echo executed test commands in run-tests.py (#1372)
run-tests.py used to echo the build commands it executed, but did
not behave the same way when it executed test commands. To make its
behavior more traceable, this patch adds echo for test commands as
well.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-22 08:51:59 +02:00
Akos Kiss
ee2e159ad6 Switch cppcheck to C99 mode (#1371)
From the beginning, we have been configuring cppcheck to check its
input as C++ source. However, the transition to C99 happened a
while ago. This patch switches cppcheck into C99 mode.

Some related changes:
* Progress reporting of cppcheck just clutters the output and makes
  warnings hard to discover. Thus, this patch puts cppcheck into a
  quieter mode where it prints anything only if a non-suppressed
  warning is found.
* The default warning format of cppcheck is a bit different from
  usual compiler error/warning format. This patch configures
  cppcheck to use a more familiar warning template.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-21 18:41:44 +02:00
Akos Kiss
70cd3d3184 Add license checking (#1353)
It's stated in the Guidelines that all contributions must be under
the Apache License 2.0. To avoid potential mistakes from manual
reviews, this patch adds the check-license.py script to
automatically check all source files for license headers.

Travis CI is also configured to run the check.

Fallout: it turned out that some files already in the code base
either miss a license header or have some minor typo differences.
The patch fixes up some of these deficiences.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-21 16:15:57 +02:00
Matthew Else
454d3af951 Initial support for mbed OS 5.1 (#1318)
- Wrappers for mbed I/O drivers
- Makefile for automating build process
- Script to generate pin definitions from mbed OS source tree
- Updates to js2c to enable building without a main.js file

JerryScript-DCO-1.0-Signed-off-by: Matthew Else Matthew.Else@arm.com
2016-09-21 15:48:03 +02:00
Akos Kiss
316223ebdb Fix doxygen-related documentation issues (#1357)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-21 10:43:40 +02:00
Akos Kiss
2300a68c88 Unify (and fix) the naming convention of structures (#1358)
The naming convention of the project for `struct`s is
`typedef struct x_t { } x_t`, but only if it has self-recursive
pointer members, otherwise `typedef struct { } x_t` is enough.
This patch applies this style consistently throughout the code
base.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-21 10:41:36 +02:00
Akos Kiss
513d9f4c9c Sync cmake and build.py defaults (#1360)
* Cmake had LTO OFF, build.py had LTO ON by default. ON became the
  common setting.
* Cmake had snapshot save/exec OFF, build.py had them ON by
  default. OFF became the common setting.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-20 16:20:48 +02:00
zherczeg
8b55a4ef7b Rewrite ecma_op_get_value_object_base to use ecma_op_object_find_own() call. (#1365)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-20 13:33:57 +02:00
Yanhui Shen
a9d6978e4b Fixing ecma_builtin_number_prototype_helper_round. (#1362)
"ecma_builtin_number_prototype_helper_round" is used by following
functions:
* ecma_builtin_number_prototype_object_to_fixed
* ecma_builtin_number_prototype_object_to_exponential
* ecma_builtin_number_prototype_object_to_precision

The current implementation does not support currying numbers and will
produce illegal digit for some test cases. For example, the result of
"0.95.toFixed(1)" is "0.:".

This patch fixs the issue, however the implementation of "toFixed" is
still problematic, at least not meet section 15.7.4.5 8.a of the
specification. The related test case is:

* assert((0.995).toFixed(2) === "0.99");
* assert((9.995).toFixed(2) === "9.99");

Reference:
* http://www.ecma-international.org/ecma-262/5.1/#sec-15.7.4.5

JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2016-09-20 13:13:50 +02:00
Zidong Jiang
7b7d86f5fd Remove the vm_run_with_inline. (#1363)
JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-09-20 13:11:53 +02:00
zherczeg
9ab72d24b7 Improve ECMA_PROPERTY_VALUE_PTR computation. (#1364)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-20 12:50:53 +02:00
Akos Kiss
971dcae669 Define __attr_hot___ for __attribute__((hot)) (#1359)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-19 15:33:54 +02:00
Zoltan Herczeg
dcaec22c0c Major property rework: introducing virtual properties.
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
2016-09-19 00:32:38 -07:00
Tilmann Scheller
ea96430e77 Add contribution guidelines and DCO. (#1348)
The current content in CONTRIBUTING.md is largely based on the "Patch Submission Process" Wiki page.

This commit also moves the DCO from the Wiki into the source tree.

In addition, clarify in README.md that contributions need to be licensed under the Apache License 2.0 and signed with the DCO.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-09-16 15:50:56 +02:00
Akos Kiss
d38ab71140 Improve the linking of libraries (#1338)
Although both jerry-libc and jerry-libm have configuration options
that enable/disable their build, in practice, only jerry-libc can be
replaced with the system (compiler-default) libc. If jerry-libm is
disabled, the build of jerry-main fails, as there is no way to
instruct the linker to link the system libm to the binary. (The
build system does have a way to pass flags to the linker, but those
flags are listed before the linked objects. For the references to
get resolved correctly, the libraries to be linked have to be
specified _after_ the objects.)

This patch adds the EXTERNAL_LINK_LIBS configuration option to
CMakeLists, which ensures that the specified libraries get
correctly passed to the linker. (E.g, replacing jerry-libm with
system libm becomes possible with
`JERRY_LIBM=OFF EXTERNAL_LINK_LIBS='-lm'`.)

Additionally, the patch also makes the following related changes:

* Removes the COMPILER_DEFAULT_LIBC configuration option, as it is
  (almost) always the opposite of JERRY_LIBC. Moreover, its name is
  misleading: its only role is to add `-nostdlib` to the linker
  flags.

* Makes use of transitive library dependencies: if a library has
  another library as dependency, and it is linked to a binary, its
  dependency is linked as well. Thus, jerry-libc, jerry-libm, and
  any external libraries are added to jerry-core as dependency, and
  then only jerry-core is linked to executables (cmake will take
  care of the rest).

* build.py and run-tests.py follow up the changes, along with some
  minor syntax changes.

* Moves static linking option to global CMakeLists, as unit test
  binaries should be linked the same way as jerry-main.

* Adds EXTERNAL_COMPILER_FLAGS and EXTERNAL_LINKER_FLAGS as last to
  the flag list, to allow user override of (nearly) anything.

The patch speculatively follows up the build system changes in the
mbed, riot-stm32f4, and zephyr targets.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-15 13:07:01 +02:00
Zidong Jiang
86ac6445e8 Fix bug in vm call_stack_size calculation (#1345)
call_stack_size should be register_count + maximum stack depth

* We don't add in the parser to save the size of snapshot header
* jerry_snapshot_version 5 -> 6

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
2016-09-15 09:54:01 +02:00
Akos Kiss
9c50570ca3 Install ARM QEMU and GCC toolchain on Travis CI only if needed (#1350)
(Also some reorganization of the .travis.yml file.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-14 14:44:39 +02:00
Akos Kiss
697037af3f Remove obsolete dependencies from install scripts (#1349)
The new build script does not support ninja anymore, and we haven't
been building bare-metal arm targets for long. This patch removes
now-obsolete dependencies from install scripts.

This can also help to reduce the load on Travis CI (as it keeps
installing dependencies for each build job over and over again).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-14 11:02:44 +02:00
Tilmann Scheller
a507c0863c Add a full copy of the Apache License 2.0 text to the project. (#1346)
Previously only a copy of the Apache License 2.0 header (for inclusion into source files) was distributed as part of the sources.

JerryScript-DCO-1.0-Signed-off-by: Tilmann Scheller t.scheller@samsung.com
2016-09-13 16:22:42 +02:00
Yanhui Shen
15c53f7363 Fix getter's this value (#1344)
JerryScript-DCO-1.0-Signed-off-by: Yanhui Shen shen.elf@gmail.com
2016-09-13 08:53:26 +02:00
Akos Kiss
baeb83db8f Move Travis CI detection logic from run-tests.py to check-signed-off.sh (#1341)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-12 15:11:14 +02:00
Zoltan Herczeg
d9979be2f6 Rewrite property get/put to not use ecma_op_object_get_own_property
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-09-12 03:33:22 -07:00
Robert Sipka
0bc7840c5f Set the number of simultaneous jobs of the build. (#1336)
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-12 09:20:24 +02:00
Akos Kiss
2e1c180658 Enable make install (#1335)
With the new build system, the conventional `cmake && make` already
works. However, the last step, i.e., `make install` was still
missing (didn't work). This patch adds the `install()` commands to
CMakeLists that are required to generate the `install` target in
the Makefile.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-09 13:32:36 +02:00
Zoltan Herczeg
da02a37a02 Remove several ecma_op_object_get_[own_]property calls.
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
2016-09-09 01:49:57 -07:00
Akos Kiss
7f80b76009 Make build.py's help output less of a "wall of text" (#1331)
`tools/build.py --help` prints a lot of output, which is sometimes
hard to comprehend, especially since some described options are
useful for developers only.

This patch:
* shortens how options are displayed in the output with the help of
  the "metavar" feature of the argparse module ("--option {on, off}"
  becomes "--option X" and the choices are listed in the description
  only); and
* hides all developer-specific options from "--help", and reveals
  them only for "--devhelp".

As a result, help output becomes more readable, especially for
ordinary users, and needs less space.

Some additional changes:
* the options are ordered in a more logical way (although that's
  somewhat subjective);
* help strings start with lowercase letters (it aligns better with
  argparse's overall style); and
* rename "--cpointer_32_bit" to "--cpointer-32bit" (underscores are
  alien to command line options).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-09 10:44:08 +02:00
Akos Kiss
2eb0c5ba1b Print warning at the correct log level in jerry-main (#1334)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-09-09 09:00:28 +02:00
robertsipka
dc83e995d2 Fix for Issue #744
Don't increment the current position in case of a continuation byte.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-09-08 14:05:14 +02:00
Sergio Abraham Martinez Rodriguez
c61e822a45 Specify profile and be able to add extra parameters to configuration (#1333)
Also added jerryscript errors to default compilation

JerryScript-DCO-1.0-Signed-off-by: Sergio Martinez sergio.martinez.rodriguez@intel.com
2016-09-08 13:04:35 +02:00
László Langó
5c330d7f8e Improve error messages
* Print location on parser errors.
 * Do not print messages on parse error if FEATURE_ERROR_MESSAGES is not set.
 * Minor style fixes

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-09-08 10:20:13 +02:00
László Langó
cf94a25753 Change JERRY_ASSERT to TEST_ASSERT in unittests
JERRY_ASSERT does not check the condition in release builds.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-09-08 08:16:16 +02:00