24 Commits

Author SHA1 Message Date
Andrey Shitov
50d124bfc3 Parser optimizations.
- parser is now non-recursive (i.e. parse function is not called recursively in any case);
 - byte-code is now more compact:
    - constants are now not immediately dumped upon occurence, but later - where necessary;
    - assignments are combined with unary / binary operations;
    - binary operations are encoded more compactly in many cases;
 - byte-code arrays are now allocated separately for each scope (so, GC of the scopes now becomes possible);
 - byte-code is dumped directly into corresponding byte-code arrays:
   - linked lists of op_meta are not now used for main code of a scope.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-12-23 14:21:10 +03:00
Ruben Ayrapetyan
1fe2817457 Introduce parser-time optimization that moves function's argument values to registers.
For functions with the optimization applied:
 - vm puts arguments values immediately to registers without putting them to variables in lexical environment;
 - number of arguments is extracted from corresponding 'reg_var_decl' instruction's argument;
 - for functions that also don't have local variables, lexical environments are not created.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-11-02 17:15:13 +03:00
Ruben Ayrapetyan
4d2ad40475 Remove var_decls_count field from scopes_tree header; getting "var_decl"s count using linked_list_get_length instead.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-11-02 17:10:45 +03:00
Ruben Ayrapetyan
1e2dfc73f5 Remove of 'this_binding' opcode.
- introduce 'const' register type;
 - adding constant register for reading ThisBinding value of active interpreter context.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-10-23 15:45:28 +03:00
Andrey Shitov
443673fc5d Update bytecode header structure so that bytecode could be stored independently from hash table and bytecode header.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-09-09 18:07:20 +03:00
Ruben Ayrapetyan
cbdc48a1fc Remove raw_instr.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-08-28 16:19:19 +03:00
Ruben Ayrapetyan
173becc3ac Rename idx_t -> vm_idx_t, opcode_special_reg_t -> vm_reg_t, INVALID_VALUE -> VM_IDX_EMPTY / VM_IDX_REWRITE_GENERAL_CASE, LITERAL_TO_REWRITE -> VM_IDX_REWRITE_LITERAL_UID.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-08-28 16:18:58 +03:00
Ruben Ayrapetyan
91aecc3bd0 Introduce parser scope types, add scope flags, indicating whether scope contains a function declaration, a 'try' statement, 'with' statement or 'delete' operator.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-08-27 17:42:45 +03:00
Andrey Shitov
a870a07972 Remove preparser lexer pass and pass for searching of "eval" and "arguments" literals.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-08-19 14:16:04 +03:00
Ruben Ayrapetyan
f7781bb7bc Remove intrinsics (native_call opcode).
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-31 17:59:03 +03:00
Ruben Ayrapetyan
502f4c4623 Split opcode and instruction entities and perform related renamings: opcode_t is now vm_instr_t, opcode position is instruction position, etc.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-28 13:43:43 +03:00
Ruben Ayrapetyan
1990762cf0 Add opcode description table containing an opcode's name, name and possible type of the opcode's arguments.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-28 13:43:43 +03:00
Ruben Ayrapetyan
06dffdec8f Remove exit completion value type.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-29 10:24:18 +03:00
Ruben Ayrapetyan
507411f0a0 Implement parse of for-in statement.
JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin e.gavrin@samsung.com
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-26 20:21:59 +03:00
László Langó
e027b4d65d Enable regular expressions.
- add regular expressions support to JS parser and interpreter;
- add tests for regular expressions.

JerryScript-DCO-1.0-Signed-off-by: Szilard Ledan szledan.u-szeged@partner.samsung.com
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
2015-06-26 13:31:10 +02:00
Ruben Ayrapetyan
a4e54e736e Support syntax error feedback in parser.
Now, parser correctly finishes parse procedure if syntax of source code is incorrect (syntax correctness is indicated using return value):
 - parser-internal memory management is performed using jsp_mm_alloc / jsp_mm_free;
 - upon detection of incorrect syntax, all parser-allocated memory regions are deallocated using jsp_mm_free_all and parse finishes with corresponding return value.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-19 17:05:15 +03:00
Ruben Ayrapetyan
bd9d1d4afd Improve allocation of memory for byte-code array and literal identifiers hash table.
- literal identifiers hash table and byte-code array are now allocated in one heap block instead of four blocks;
 - memory regions with the hash tables and arrays are now linked into linked list using headers at start of the regions instead of using array_list.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-19 16:25:34 +03:00
Ruben Ayrapetyan
446e8bf989 Replacing 'this_arg' meta opcode with more general 'call site additional information' meta opcode with flags describing the call site features, and, optionally, 'this' argument.
Introducing opcode_call_flags_t for argument of the new meta opcode, currently with two flags: 'have this argument' and '"direct call to eval" form'.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-13 18:17:23 +03:00
Andrey Shitov
3577261261 Add support for eval in parser.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-06-13 18:01:30 +03:00
Andrey Shitov
53801e3b41 Replace array of literals with literal storage.
JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin e.gavrin@samsung.com
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-06-10 21:40:10 +03:00
Ruben Ayrapetyan
cb600da269 Introducing 'scope flags' opcode containing set of flags that indicate various properties of a scope; replacing 'strict mode' meta opcode with a flag in the flags set.
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-05-28 19:12:54 +03:00
Andrey Shitov
7c67606b00 Parser refactoring. Remove deserializer notion. 2015-04-07 13:05:19 +03:00
Andrey Shitov
e459ab7d64 Optimize parser memory consumption. Remove 'prev' and 'block_size' fields form the linked list structure. Remove 'magic' field from structures used in parser. 2015-04-01 11:48:23 +03:00
Ruben Ayrapetyan
88353e93cf Renaming core -> jerry-core. 2015-02-17 19:08:55 +03:00