Commit Graph

56 Commits

Author SHA1 Message Date
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
Ruben Ayrapetyan 27f6d2b552 Fixing test_poolman that is failing after 6b050cc03719bfdb49b68eeb5deeed61bc51ff5a. 2014-07-25 20:23:34 +04:00
Ruben Ayrapetyan 09c1f91bb3 Printing heap's block headers before beginning of unit test. 2014-07-25 20:00:59 +04:00
e.gavrin 65b4968a69 fix text 2014-07-25 19:24:19 +04:00
Ruben Ayrapetyan 5e4078095a Print heap memory usage statistics before exit (host version). 2014-07-25 19:09:10 +04:00
Ruben Ayrapetyan 61550f2029 Fixing opcode unit tests. 2014-07-24 20:04:27 +04:00
Ruben Ayrapetyan b7a3a13bc9 Implementing register variables. 2014-07-24 18:13:32 +04:00
Ruben Ayrapetyan 2718d8e918 Fixing is_false_jmp, is_true_jmp opcodes; adding them to var_decl and assignment unit tests as partial checks. 2014-07-23 22:22:50 +04:00
Ruben Ayrapetyan 0eea67ceb2 Renaming camelCase-named identifiers in unit tests' code. 2014-07-23 14:14:45 +04:00
Ruben Ayrapetyan 488ed41c2b Implementing 'substraction' opcode handler and, partially (except string operands), 'addition' opcode handler; adding unit tests for them. 2014-07-22 18:55:13 +04:00
Ruben Ayrapetyan cbbd71588a Implementing 'division' and 'remainder' opcode handlers, adding unit tests for the opcodes. 2014-07-22 18:26:06 +04:00
Ruben Ayrapetyan 739d19be5b Implementing 'multiplication' opcode handler and unit test for the opcode. 2014-07-21 21:59:15 +04:00
Ruben Ayrapetyan ff4d3e4af3 Implementing assignment of number literal values in 'assignment' opcode handler. 2014-07-21 19:22:25 +04:00
Ruben Ayrapetyan 30c383556d Unit test for 'assignment' opcode. 2014-07-21 18:09:05 +04:00