2382 Commits

Author SHA1 Message Date
Zoltan Herczeg
08c312bc55 Remove ECMA_STRING_CONTAINER_HEAP_NUMBER.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-30 05:09:51 -07:00
Zoltan Herczeg
8c92972b2f Passing less number of arguments to a function is generally faster. So
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
2016-05-29 23:47:46 -07:00
Robert Sipka
379698733a Optimising the ToString operation
Create new ecma-string from positive integers without cast it to ecma_number

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-05-26 10:33:38 +02:00
Zoltan Herczeg
fec6944a2a When array literals are created, there is no need to check whether
the property already exists. This improves the performance.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-25 06:51:14 -07:00
Zoltan Herczeg
48b01d0f74 Improve the performance of ecma_op_general_object_put. The ecma_op_object_can_put
function is removed and incorporated into ecma_op_general_object_put. Also most
properties are directly created / updated instead of using ecma_builtin_helper_def_prop.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-25 06:41:32 -07:00
Zoltan Herczeg
ac3aa30c82 Micro optimizations of the virtual machine:
- Branch argument information is encoded in the vm byte
   code data, so CBC flags are not loaded anymore
 - The free_flags variable is removed from the vm_loop
 - Two cases are removed from "get arguments", argument
   processing is simplified
 - The two opcode tables are merged to one
 - The VM_OC_POP opcode has no result, so the break is changed to continue.
 - The VM_OC_PUSH_NUMBER can use ecma_make_integer_value.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-24 02:29:49 -07:00
Zoltan Herczeg
be273d874f When the same value is assigned to a property, and its reference
counter is one, dereferencing the value frees its allocated memory.
In this case we return early.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-24 02:17:05 -07:00
Akos Kiss
e4b0d81fbf Print each output line with one command in test runners
When running multiple test suites in parallel -- e.g., as it
happens on the CI --, the names of the executed commands and the
results of the executions can/do get printed far from each other,
interrupted by other prints. This can make the reading of the
output hard. This patch prints each line with one echo command,
which makes the interruption of the line less likely.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-05-23 14:46:17 +02:00
Zoltan Herczeg
76ae2001a1 Complete reworking of ecma_op_general_object_define_own_property.
Unnecessary checks are removed, new checks are added to skip
unneeded code paths.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-23 03:19:20 -07:00
Zoltan Herczeg
53414b2c88 Add ecma_fast_copy_value and ecma_fast_free_value to improve performance of hot paths.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-23 02:53:43 -07:00
Zsolt Borbély
9f29cc168d Update memory-related defines
Set the correct defines in CMakeLists.txt and update another occurrences in scripts.

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-05-22 23:19:10 +02:00
Zsolt Borbély
6b18710bc1 Get rid of the remains of heavy debug
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-05-20 16:32:29 +02:00
László Langó
92bb551d45 Change 'mem' namspace to 'jmem'
The 'mem_' prefix is too general, so it might clash with
symbols in other libraries. Renamed the directory, file,
funtion and type names.

Related issue: #1052

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-20 16:01:33 +02:00
Zoltan Herczeg
aaa3d22677 Remove unused collection based argument passing to the vm interpreter.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-20 05:51:41 -07:00
Zoltan Herczeg
5ecf83ee8a Change internal property values of built-in primitive objects (namely Number,
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
2016-05-20 03:15:11 -07:00
Robert Sipka
1c028d96d6 Unify the condition form within the asserts
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
2016-05-20 11:18:07 +02:00
Akos Kiss
c7d33e9887 Don't concatenate multiple JS scripts in jerry
Jerry (the command line tool) has been supporting the execution of
multiple script files for long. However, until now, it simply
concatenated all sources into a single source buffer and
parsed/executed them as one unit. Other JS execution tools (e.g.,
jsc, v8) load and execute separate files as separate units -- but
still in the same execution environment. The most significant
effect of this approach is that the `"use strict;"` directive (or
the absence of it) at the beginning of each JS script file takes
effect as expected (i.e., as if the script was executed alone).
Contrarily, the concatenation-based approach forces the strictness
of the first script on all the rest (i.e., if the first script
starts with `"use strict";` the rest is also executed in a strict
environment even if they did not contain the directive, and vice
versa).

This patch makes the jerry command line tool to load/parse/run one
unit at a time.

Side effects:
- As there is no need for separate file read routines that load one
  file (a snapshot) or concat multiple (JS sources) anymore, those
  routines got merged.
- Both previous read routines used multiple stdio functions
  (`fseek`, `ftell`, and `rewind`). This has been simplified to
  rely on `fread` only to find out the length of the input.
- This simplification made the above mentioned functions
  superfluous in jerry-libc.
- As some error messages had to be touched in this patch, several
  more have been beautified to make them more consistent.
- One small change was needed in `jerry_parse` in jerry-core to
  allow subsequent parsing of multiple sources (without that, an
  assertion was triggered).

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-05-19 12:07:54 +02:00
László Langó
e1c8a2ec96 Run JS regression tests in snapshot mode too
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-18 17:05:13 +02:00
Akos Kiss
de5b77d135 Shrink test logs by not printing full paths
Both JS test suite and unit test logs can grow large as Makefile
invokes run-test-suite.sh and run-unittests.sh with absolute paths
to engines and test directories, which get then printed quite
often. This patch adds code to the runner scripts to determine the
longest directory path common to the current working directory, the
invoked script, the test directory, and the engine (in case of JS
tests). Then, when a path is to be printed, this common path
component is skipped.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-05-18 14:08:25 +02:00
Zoltan Herczeg
12a58e6fc6 Byte code related symbolic constants and macros in vm.h get better names
and comments. Space consumed by opcode triplets are reduced to 16 bits
down from 32 bits. This reduces the opcode triplet tables by 220 bytes.
New symbolic constants and defines were also added to describe common
operations.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-18 05:00:33 -07:00
Zoltan Herczeg
7b9e6a873f Integer acceleration for basic arithmetic and comparison.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-18 04:51:58 -07:00
László Langó
07dabff1ab Update API reference
* Fixed code style issues
 * Updated the documentation of 'jerry_parse' and 'jerry_run'
 * Fixed broken anchor formats
 * Fixed 'jerry_api_value_t' usage
 * Updated fuction parameters

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-18 11:22:29 +02:00
László Langó
0ff35311ca Add new API examples
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-17 16:22:33 +02:00
László Langó
1938415b0d Remove 'test-js-precommit' target from Makefile
When performing `make precommit`, instead of running only a subset of
the Jerry Test Suite on full profile builds, run the whole suite, and
also run the compact subset of the suite on compact builds. Also, make
CI perform the same tests.

Related issue: #879
Related PR: #912

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-17 15:42:27 +02:00
Zoltan Herczeg
00f759e275 Introduce integer ecma-value representation to reduce the double allocations.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-17 00:11:19 -07:00
Zoltan Herczeg
7cf8b79429 Argument literal names were not stored in the snapshot, because the
names were replaced by empty strings before that. The snapshot form
of tests/jerry/arguments.js fails because of this issue.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-05-16 23:49:41 -07:00
László Langó
2d7f1d1070 Warning fixes for jerry-libm
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-13 15:52:56 +02:00
László Langó
953e45f266 Remove 'ecma_assert_object_type_is_valid' from release
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-13 15:29:49 +02:00
László Langó
210ba6dc85 Update API-EXAMPLE.md
Fix Jerry style and update to the current API.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-10 12:44:18 +02:00
Akos Kiss
7e0cd850a7 Fix check-signed-off.sh: remove CR from git show output
When merging PRs via the GitHub web interface, CR characters can
sporadically appear in the commit message. This can also cause
signed-off-by message mismatch in check-signed-off.sh (even if
everything else is OK). To be on the safe side, this patch removes
any CR characters from the output of git show when performing the
check.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-05-09 11:35:39 +02:00
Robert Sipka
de1912f6f8 Improve the string descriptor.
Separate the utf-8 and ascii strings.
In case of ascii strings the size is equal to the length, so we able to store this information
in the string descriptor instead of using the string header to store it.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-05-09 09:58:11 +02:00
Rob Moran
54d6e1f44f Updated readme.md to reflect new folder structure.
JerryScript-DCO-1.0-Signed-off-by: Rob Moran github@thegecko.org
2016-05-07 17:42:03 +01:00
László Langó
fe3c269e99 Fix return value of 'jerry_api_get_object_field_value'
Fixed the return value to return false when the field does
not exist as the documentation says.

Related issue: #1041

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-06 21:07:19 +02:00
László Langó
2a5468a2ac Improve double to string conversion
Added errol implementation. Fixed '3d-raytrace.js', because
the new algorithm has better precision and also reduce the
code size.

JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-05-06 14:53:50 +02:00
Imre Kiss
5369fd4515 Merged target for mbed boards.
Merged the mbed releated targets into one source.
Available targets: FRDM-K64f, Discovery-STM32F4, Discovery-STM32F429ZI, NUCLEO-STM32F4

JerryScript-DCO-1.0-Signed-off-by: Imre Kiss kissi@inf.u-szeged.hu
2016-05-06 13:33:26 +02:00
Robert Sipka
94161d350a Check the return value of the gettimeofday() in 'jerry_port_get_time_zone' and 'jerry_port_get_current_time' functions.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-05-06 10:50:39 +02:00
Robert Sipka
3de4170c15 Unified the commenting form of the internal properties and removed the unused types.
JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-05-05 15:06:25 +02:00
Zsolt Borbély
7813801cd3 Fix wrong indentations of function parameters
JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
2016-05-02 13:38:28 +02:00
Robert Sipka
19b972b8eb Check whether the aligned pointers value of the internal properties can be stored directly in ecma_value_t.
Those internal properties which have a primitive value field or where the property value type
is an ecma_object_t ptr were checked earlier.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-05-02 10:54:48 +02:00
Robert Sipka
af65a9e912 Store aligned pointers directly in ecma_value_t if it is possible.
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
2016-05-02 10:20:56 +02:00
Akos Kiss
33a1203d6b Drop jerry_port_putchar
Recent changes eliminate the need for `jerry_port_putchar`. As port
API discussions don't make it likely that it will ever be needed
again, this patch removes its declaration from jerry-port.h and its
implementations from the port(s).

The related code in jerry-libc is not needed either: whatever `putc`
(and `puts`) can do, `printf` can do as well.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-23 22:50:50 +02:00
Akos Kiss
0c7d3fb705 Factor out common error dispatch call functionality into helper
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-22 16:16:05 +02:00
Akos Kiss
27682017e9 Remove unused internal functions
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
2016-04-22 14:39:43 +02:00
robertsipka
a87aca4d84 Don't use pointer compression where the ecma_value can store pointer value directly
This changes affects those internal properties where the property value type is an ecma_object_t ptr.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
2016-04-22 14:30:53 +02:00
Dániel Bátyai
3203613b07 Add some asserts to check heap structure consistency
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2016-04-22 13:59:34 +02:00
Akos Kiss
68f3465eb5 Change current time from uint64_t to double in Date Port API
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-21 14:51:31 +02:00
László Langó
80bfb61b13 Remove unnecessary error bit negation
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2016-04-21 09:36:42 +02:00
Akos Kiss
b523cf3cd1 Introduce the Date Port API
Replaced `gettimeofday`-related code with `jerry_port_get_current_time`
and `jerry_port_get_time_zone` function calls. Moved old code to
default port implementation.

Removed `ENABLE_DATE_SYS_CALLS` as date syscalls should "just work".

Fix DST adjustments: even if `gettimeofday` returns meaningful data in
`tz_dsttime`, the value is just a flag (or, according to some sources,
a tri-state value: >0 if DST applies, ==0 if DST does not apply, <0 if
unknown). Hitherto, the field was simply added to/subtracted from a
time value in milliseconds. To use it approximately correctly, the
field's value should be multiplied by "millisecs/hour".

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-20 17:56:30 +02:00
Zoltan Herczeg
a3b1db3638 Add property name hashing support.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2016-04-20 03:38:43 -07:00
Akos Kiss
02ba19f24d Introduce the Termination Port API
* Moved the error codes to jerry-port.h and declared port function
  `jerry_port_fatal`.

* Moved "exit or abort on fail" functionality to the newly added
  jerry-port-default-fatal.c.

* This implied that a default port-specific API had to be introduced:
  functions `jerry_port_default_set_abort_on_fail` and
  `jerry_port_default_is_abort_on_fail` declared in jerry-port-default.h
  control the fatal exit behaviour.

* For the sake of clarity, renamed jerry-port.c to
  jerry-port-default-io.c.

* Adapted CMakeLists to deal with port implementations consisting of
  more then one source file and exposing headers. This also required
  the renaming of `EXTERNAL_PORT_FILE` cmake option to
  `EXTERNAL_PORT_DIR`.

* Adapted main sources to use the default port header for the
  abort-on-fail functionality, as that is not part of the core jerry
  API anymore.

* Added default port implementation to the static source code checker
  tools.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2016-04-19 14:10:18 +02:00