119 Commits

Author SHA1 Message Date
Ruben Ayrapetyan
4dbc6a9d1a Implementing [[Construct]] for external function objects. 2015-04-06 12:31:29 +03:00
Ruben Ayrapetyan
83730cd6bb Implementing dispatcher for calling native handlers associated with external function objects; implementing interface for unified storage of native pointers in ecma objects. 2015-04-03 23:38:52 +03:00
Ilyong Cho
23ade8f4ff wip: Implementing external function api 2015-04-03 18:11:21 +09:00
Ruben Ayrapetyan
eb3686a49d Adding jerry_api_is_constructor interface that check if specified object is a function object that implement [[Construct]] method; changing jerry_api_is_function to recognize bound and built-in functions; optimizing jerry_api_call_function. 2015-04-01 12:39:29 +03:00
Ilyong Cho
3c2009d331 Adding Jerry api for calling function with specific this binding. 2015-04-01 11:06:20 +09:00
Ruben Ayrapetyan
33cfaa73b3 Implementation of unimplemented Jerry API parts; adding Jerry API unit test based on test prepared by Ilyong. 2015-03-30 20:54:55 +03:00
Ruben Ayrapetyan
f42faabe89 Fixing style according to rules defined in vera++ scripts. 2015-02-17 19:47:00 +03:00
Ruben Ayrapetyan
03c81e96e9 Turning on unit tests build and run during precommit. 2015-02-16 19:35:15 +03:00
Ruben Ayrapetyan
43ea53b1d7 Jerry is now split to several components: core, libc, plugins.
The components are build independently and then are linked with main module corresponding to target platform.
Core is supposed to be platform-independent, while libc and plugins are dependent on specific architecture / platform.

The commit disables unit tests building and running during precommit.
That is supposed to be fixed in a subsequent commit.

Also, the commit disables building and running valgrind targets during precommit.
Build is supposed to be turned on by an option that should be introduced later.
Valgrind-checked runs are supposed to be performed in asynchronous mode.
2015-02-13 21:54:27 +03:00
Ruben Ayrapetyan
7e4c16e4e6 Rename Jerry's libc functions: __function_name -> function_name. 2015-02-12 20:15:56 +03:00
Ruben Ayrapetyan
718bbe26f9 Refinement of project structure.
- components renaming and moving:
   - liballocator -> mem;
   - libcoreint -> vm;
   - libecmaobjects -> ecma/base;
   - libecmaoperations -> ecma/operations;
   - libecmabuiltins -> ecma/builtins;
   - libjsparser -> parser/js;
   - libintstructs -> parser/collections;
   - liboptimizer -> parser/js;
   - libperipherals -> ../plugins/lib_device_stm;
   - libruntime -> jrt;
 - generated.h now is created as intermediate during build;
 - benchmarks -> tests/benchmarks;
 - docs -> documentation;
 - demo-applications removed (loop_demo.js -> tests/blinky.js).
2015-02-10 19:00:32 +03:00
Ruben Ayrapetyan
fa6402334f Renaming sources *.c -> *.cpp. 2015-02-09 18:21:44 +03:00
Ruben Ayrapetyan
005b5370fc Switching to g++ and corresponding changes according to C++ requirements. 2015-01-16 17:27:02 +03:00
Ruben Ayrapetyan
6bb39bb8ea Introducing 'try to give memory back' callback for heap allocator to use upon allocation request that can not be satisfied by the allocator. 2014-12-18 22:25:22 +03:00
Ilmir Usmanov
dc8ab27900 Split parser into parser itself, opcodes dumper and syntax errors checker.
Add internal hash map of literal indexes:
  In this hash map key is pair of block number and literal's unique identifier in the block, and the value is a literal index that unique in the whole program.
  Block is a continues array of opcodes. So, bytecode is splitted into blocks.
  Each block has its own uid counter. To get literal index the interpreter looks up it in the hash map.
  Thus, now JS program is able to have more than 255 identifiers/string literals.
  The first 128 (0-127) uids are reserved for block's uid counter, the other 128 (128-255) are reserved for tmp variables.
2014-12-10 18:31:59 +03:00
Ilmir Usmanov
fc9e83d290 Remove obsolete unit tests. 2014-12-10 18:29:43 +03:00
Ruben Ayrapetyan
c21e186f2c Static definition of pool's area size and number of chunks in a pool; alignment of mem_block_header_t and mem_pool_state_t to MEM_ALIGNMENT. 2014-11-26 19:23:26 +03:00
Ruben Ayrapetyan
bd60d1874b Implementing resize of heap blocks.
- adding mem_heap_try_resize_block routine that tries to resize
   block using free space that is located right after the resized block;
 - placing long-term blocks from start of heap space and short-term - from end
   of the space to increase probability of success of resizing just allocated
   long-term block;
 - adding mem_heap_try_resize_block invocation to 'test_heap' unit test.
2014-11-11 15:44:31 +03:00
Ilmir Usmanov
8c7dc08d93 Add literals - replacements of strings and numbers in parser. 2014-10-31 21:22:52 +04:00
Ruben Ayrapetyan
e4629cca51 Improving precision of number to zt-string conversion, adding search for the shortest representation of number during the conversion. 2014-10-24 19:15:31 +04:00
Ilmir Usmanov
62a42fa087 Add fail tests. Fix parser. 2014-10-21 20:35:07 +04:00
Ruben Ayrapetyan
47ed774232 Fixing obj_decl opcode handler to handle property name argument as index of register variable containing a declared property's name. 2014-10-15 17:33:58 +04:00
Ilmir Usmanov
18618c6501 Freaking FINALLY: postparser 2014-10-12 20:34:23 +04:00
Ilmir Usmanov
29ffa6f777 Pretty-printer refactoring. Add pretty-printing of metas. 2014-10-09 13:19:36 +04:00
Ilmir Usmanov
3d3da5d481 Preparser: new pass to order var_decls prior to parser 2014-10-07 20:14:41 +04:00
Ilmir Usmanov
8a5b956e38 Simplify serializer/deserializer. Reduce memory usage in lexer. Create HashTable data structure. Finish preparations for introducing new strings addressation. 2014-09-23 16:45:10 +04:00
Ilmir Usmanov
d4cd8be349 Fix asserts in opfunc_*jmp_down functions. 2014-09-16 22:36:26 +04:00
Ilmir Usmanov
e77bd4f4e5 Add try-catch-finally support: parse and generate opcodes for this construct
Fix varg generation: generate *_n opcodes with parameters in following meta opcodes
Add stack internal structure: dimanically allocated stack.
Use dynamically allocated memory in parser: every local and global variables are stored in dinamically allocated stacks.
Use dynamically allocated memory in serializer: opcodes are also stored in stack.
Change is_true_jmp and is_false_jmp opcodes to relative.
Change *jmp* opcodes to be able to store opcode_counter_t instead of idx_t.
2014-09-16 21:32:59 +04:00
Ruben Ayrapetyan
cd41b236d9 Statistics of memory usage during interpretation. 2014-09-16 21:19:07 +04:00
Ruben Ayrapetyan
4d34bab9a0 Adding memory leak checks to unit tests. 2014-09-05 20:35:33 +04:00
Ruben Ayrapetyan
c5dd81cf76 Fixing memory leak in opfunc_throw. 2014-09-05 20:28:02 +04:00
Ruben Ayrapetyan
b9fd80ce36 Fixing object declaration and function expression opcode handlers; adding unit test that declares object and operates on the object's properties. 2014-09-04 21:02:29 +04:00
Ruben Ayrapetyan
50371ddf20 Implementing Array construction routine; adding unit test on array operations. 2014-09-03 17:30:03 +04:00
Ruben Ayrapetyan
76de0e9a06 Improving precision of ecma_number_to_string in case number can be represented as UInt32. 2014-09-03 15:05:58 +04:00
Ruben Ayrapetyan
813831a23b Decimal conversion of Number to zt-string (still not precise enough). Zt-string copy and length calculation helpers. 2014-09-01 21:12:02 +04:00
Ruben Ayrapetyan
e35f54fe86 Implementing ECMA String to Number conversion helper. 2014-08-29 22:46:38 +04:00
Ruben Ayrapetyan
ddb2e6e9d5 Introducing and implementing 'throw' and 'try' opcode handlers. 2014-08-28 18:57:34 +04:00
Ruben Ayrapetyan
5d2b535cec Implementing 'with' opcode; replacing 'end_with' opcode with 'meta' opcode of corresponding type. 2014-08-27 21:38:53 +04:00
e.gavrin
a99907670b OPCODE define replaced with opcode_t. T_IDX define replaced with idx_t. 2014-08-23 00:53:41 +04:00
e.gavrin
0eece0be5a Remove not needed opcode-support.[c,h] 2014-08-23 00:24:49 +04:00
e.gavrin
d80cb10361 Refine opcodes OP_LIST macro. Removed ambiguous lists of opcodes in several files. The only list is in opcodes.h 2014-08-23 00:16:56 +04:00
e.gavrin
d4a9d9430e Refactoring of libcoreint part1 2014-08-23 00:16:56 +04:00
Ruben Ayrapetyan
a96705701d Implementing prototype of ToString (Number) routine - ecma_number_to_zt_string; adding unit tests for the routine. 2014-08-21 14:43:43 +04:00
Ilmir Usmanov
2e1da4cae5 Quickfix N2 2014-08-12 22:48:24 +04:00
Ruben Ayrapetyan
7b04e9eaeb Compacting pool header to 8 bytes. Replaced typed pool chunks with fixed-size untyped ones. loop_arithmetics_1kk.js benchmark: 2.98517 -> 2.9443. 2014-08-08 23:11:06 +04:00
Ruben Ayrapetyan
0194e63331 Removing pool bitmaps; optimizing search for free pool chunks. loop_arithmetics_1kk.js benchmark: 4.134s -> 3.479s. 2014-08-08 14:26:28 +04:00
Ilmir Usmanov
bfe2293d43 Replace repeated var_decls with nop 2014-08-05 14:52:03 +04:00
Ilmir Usmanov
3b624be051 Fix adjusting jumps 2014-08-05 11:51:49 +04:00
Ilmir Usmanov
2809ffb36d Add scope reordering ("use strict" -> func_decl -> var_decl -> other opcodes); Add --show-opcodes console parameter 2014-07-31 19:30:27 +04:00
Ilmir Usmanov
e497875c06 Change strings offset size from 8 bits to 16 bits 2014-07-29 17:49:13 +04:00