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
This commit is contained in:
Andrey Shitov
2015-11-03 19:14:19 +03:00
committed by Ruben Ayrapetyan
parent b1de93abd6
commit 50d124bfc3
51 changed files with 9044 additions and 7401 deletions
+3 -20
View File
@@ -137,8 +137,6 @@ typedef enum
OPCODE_META_TYPE_CATCH_EXCEPTION_IDENTIFIER, /**< literal index containing name of variable with exception object */
OPCODE_META_TYPE_FINALLY, /**< mark of beginning of finally block containing pointer to end of finally block */
OPCODE_META_TYPE_END_TRY_CATCH_FINALLY, /**< mark of end of try-catch, try-finally, try-catch-finally blocks */
OPCODE_META_TYPE_SCOPE_CODE_FLAGS, /**< set of flags indicating various properties of the scope's code
* (See also: opcode_scope_code_flags_t) */
OPCODE_META_TYPE_END_FOR_IN /**< end of for-in statement */
} opcode_meta_type;
@@ -155,23 +153,6 @@ typedef enum : vm_idx_t
*/
} opcode_call_flags_t;
/**
* Flags indicating various properties of a scope's code
*/
typedef enum : vm_idx_t
{
OPCODE_SCOPE_CODE_FLAGS__EMPTY = (0u), /**< initializer for empty flag set */
OPCODE_SCOPE_CODE_FLAGS_STRICT = (1u << 0), /**< code is strict mode code */
OPCODE_SCOPE_CODE_FLAGS_NOT_REF_ARGUMENTS_IDENTIFIER = (1u << 1), /**< code doesn't reference
* 'arguments' identifier */
OPCODE_SCOPE_CODE_FLAGS_NOT_REF_EVAL_IDENTIFIER = (1u << 2), /**< code doesn't reference
* 'eval' identifier */
OPCODE_SCOPE_CODE_FLAGS_ARGUMENTS_ON_REGISTERS = (1u << 3), /**< function's arguments are moved to registers,
* so should be initialized in vm registers,
* and not in lexical environment */
OPCODE_SCOPE_CODE_FLAGS_NO_LEX_ENV = (1u << 4) /**< no lex. env. is necessary for the function */
} opcode_scope_code_flags_t;
/**
* Types of byte-code instruction arguments, used for instruction description
*
@@ -246,7 +227,9 @@ typedef struct
} vm_run_scope_t;
vm_instr_counter_t vm_calc_instr_counter_from_idx_idx (const vm_idx_t, const vm_idx_t);
vm_instr_counter_t vm_read_instr_counter_from_meta (opcode_meta_type, vm_frame_ctx_t *);
vm_instr_counter_t vm_read_instr_counter_from_meta (opcode_meta_type,
const bytecode_data_header_t *,
vm_instr_counter_t);
typedef struct vm_instr_t
{