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
Hanjoung Lee
f20db76dfb
Fix parse error of parse_switch_statement
...
Related issue: #725
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
2015-11-27 12:19:09 +09:00
Ilyong Cho
94cb6aec26
Fix prop_getters stack manipulation for assignment expression.
...
Related issue: #614
JerryScript-DCO-1.0-Signed-off-by: Ilyong Cho ily.cho@samsung.com
2015-11-09 11:02:57 +09:00
Ruben Ayrapetyan
911163e787
Optimize object literal byte-code - store property names as literal arguments, instead passing them through register variables.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-11-02 17:47:18 +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
841c1ed61c
Fix usage of array_list in parse_switch_statement.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-11-01 16:51:43 +03:00
Ruben Ayrapetyan
f2ced3d91c
Fix check for 'eval' and 'arguments' functions' names / argument names in strict mode.
...
Related issue: #686
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-10-30 17:31:04 +03:00
Ruben Ayrapetyan
3025bd1750
Fix handling of SyntaxError in FormalParameterList during 'new Function' constructor operation.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-10-30 17:26:17 +03:00
Hanjoung Lee
906558b8e9
Fix: switch statement jumps to incorrect case body
...
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
2015-10-29 19:16:12 +09:00
Hanjoung Lee
3e31931537
Fix: parse error when no expression follows after 'return', 'break', 'continue'
...
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
2015-10-29 18:06:28 +09:00
Hanjoung Lee
fcebf654cc
Fix: parser bug in parse_switch_statement
...
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
2015-10-29 11:09:48 +09:00
Hanjoung Lee
448984dd74
Fix: parsing regex and div operator correctly
...
JerryScript-DCO-1.0-Signed-off-by: Hanjoung Lee hanjoung.lee@samsung.com
2015-10-22 14:15:18 +09: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
9da91d0834
Remove inside_eval from limitations on var-to-reg optimization.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-09-09 16:58:52 +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
0111a73702
Convert parser operand structure to jsp_operand_t class, move operand types to enum defined in the class.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-08-28 15:35:06 +03:00
Ruben Ayrapetyan
5b9ce05491
Introduce parser-time optimization that replaces a function's local variables with registers.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-08-27 17:42:45 +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
e4843ece76
Fix processing of elision in array literal.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-08-24 14:51:24 +03:00
Andrey Shitov
01604974e3
Free eval's code and literal hash-table after its execution if it does not contain functions.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-08-24 14:44:16 +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
Andrey Shitov
0d855e898d
Fix hoisting of function declaration from function expressions.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-08-11 15:01:45 +03:00
Andrey Shitov
531a9d3352
Fix invalid preparsing of variable declarations which are not splitted by comma.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-08-11 14:39:02 +03:00
Andrey Shitov
d6ad1c467e
Fix semicolon check after variable declaration list.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-08-11 14:23:11 +03:00
Ruben Ayrapetyan
c41f76aba2
Support up to 65535 items in object / array literals.
...
Related issue: #276
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-08-03 15:54:53 +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
6ade8dfebb
Fix preparse_scope - consider nesting level during search for identifier tokens.
...
Related issue: #440
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-22 14:50:57 +03:00
Andrey Shitov
4fdb5249b9
Restore "Fix preparsing of variable declaration lists, which are not divided by a semicolon." 06d0c1806d7ceff5192feee996c770b42bc1e1e9) that was incorrectly removed in abc2b55297eff13538fca2440d127ba79cdcc8b3.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-15 20:20:26 +03:00
Ruben Ayrapetyan
abc2b55297
Fix dump of arguments / eval usage hint in preparse_scope.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-15 17:24:54 +03:00
Ruben Ayrapetyan
44b7b95781
Add support of ReferenceError early error to parser.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-15 17:00:45 +03:00
Andrey Shitov
06d0c1806d
Fix preparsing of variable declaration lists, which are not divided by a semicolon.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-15 16:53:41 +03:00
Ruben Ayrapetyan
7ccec19c26
Fix strict mode in an object initializer's getters / setters definition.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-15 13:32:02 +03:00
Andrey Shitov
4f58104981
Fix checking of semicolons in expression statements.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-15 13:15:25 +03:00
Ruben Ayrapetyan
0e8cb596d7
Fix parse of preincrement / predecrement, applied to 'obj.prop'-like expressions.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-15 13:04:02 +03:00
Ruben Ayrapetyan
6fe78cc994
Temporary workaround (until parser is refactored) for fixing evaluation of simple 'identifier'-like expressions.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-15 12:52:42 +03:00
Ruben Ayrapetyan
c120433158
Fix handling of EOF in insert_semicolon.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-15 12:31:47 +03:00
Ruben Ayrapetyan
92bf7859af
Put lexer_init after setjmp in parser_parse_program, as lexer_init could raise an early error.
...
Related issues: #341
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-14 18:42:49 +03:00
Ruben Ayrapetyan
aa415c670e
Fix initialization of 'this' argument in 'call_n' opcode handler.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-13 19:31:07 +03:00
Andrey Shitov
b3fa7d9765
Fix function skipping in preparse_scope: properly detect usage of 'function' keyword as property name.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-13 18:01:18 +03:00
Andrey Shitov
7f1a7981b9
Support true, false, null as property names.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-13 18:01:17 +03:00
Andrey Shitov
d5fd0b09b1
Properly process Use Strict which contains EscapeSeqence or LineContinuation.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-09 12:43:13 +03:00
Andrey Shitov
17cdc35d6d
Fix detection of Use Strict directive not in the start of Directive Prologue.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-09 12:43:03 +03:00
Andrey Shitov
146ac15b5f
Change locus type from size_t to lit_utf8_iterator_pos_t.
...
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
2015-07-08 15:53:33 +03:00
Evgeny Gavrin
69fe6199c0
Add syntax check for return from global scope/eval.
...
Related issue: #129
JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin e.gavrin@samsung.com
2015-07-02 19:12:41 +03:00
Ruben Ayrapetyan
b45302ee07
Fix propagation of strict mode.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-07-01 14:44:12 +03:00
Ruben Ayrapetyan
ec02ace0e9
Fix syntax check for duplicate parameter names in a strict mode function.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-30 15:22:21 +03:00
Ruben Ayrapetyan
4870550c8a
Fix false-positive unexpected EOF in preparse_scope.
...
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan r.ayrapetyan@samsung.com
2015-06-30 14:52:20 +03:00