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:
committed by
Ruben Ayrapetyan
parent
b1de93abd6
commit
50d124bfc3
@@ -795,6 +795,8 @@ FIXME (Move to library that should define the type (literal.h /* ? */))
|
||||
typedef rcs_record_t *literal_t;
|
||||
typedef rcs_cpointer_t lit_cpointer_t;
|
||||
|
||||
#define NOT_A_LITERAL (lit_cpointer_t::null_cp ())
|
||||
|
||||
/**
|
||||
* ECMA string-value descriptor
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "bytecode-data.h"
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
@@ -29,7 +30,6 @@
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "lit-char-helpers.h"
|
||||
#include "lit-magic-strings.h"
|
||||
#include "serializer.h"
|
||||
#include "vm.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-lex-env.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "serializer.h"
|
||||
#include "lit-magic-strings.h"
|
||||
#include "parser.h"
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "bytecode-data.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-eval.h"
|
||||
@@ -21,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-lex-env.h"
|
||||
#include "parser.h"
|
||||
#include "serializer.h"
|
||||
#include "vm.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -114,7 +114,7 @@ ecma_op_eval_chars_buffer (const jerry_api_char_t *code_p, /**< code characters
|
||||
|
||||
if (!code_contains_functions)
|
||||
{
|
||||
serializer_remove_bytecode_data (bytecode_data_p);
|
||||
bc_remove_bytecode_data (bytecode_data_p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "bytecode-data.h"
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
@@ -255,15 +256,14 @@ ecma_op_create_function_object (ecma_collection_header_t *formal_params_collecti
|
||||
bool is_no_lex_env = false;
|
||||
|
||||
vm_instr_counter_t instr_pos = first_instr_pos;
|
||||
opcode_scope_code_flags_t scope_flags = vm_get_scope_flags (bytecode_header_p, instr_pos++);
|
||||
|
||||
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_STRICT)
|
||||
if (bytecode_header_p->is_strict)
|
||||
{
|
||||
is_strict_mode_code = true;
|
||||
}
|
||||
|
||||
if ((scope_flags & OPCODE_SCOPE_CODE_FLAGS_NOT_REF_ARGUMENTS_IDENTIFIER)
|
||||
&& (scope_flags & OPCODE_SCOPE_CODE_FLAGS_NOT_REF_EVAL_IDENTIFIER))
|
||||
if (!bytecode_header_p->is_ref_arguments_identifier
|
||||
&& !bytecode_header_p->is_ref_eval_identifier)
|
||||
{
|
||||
/* the code doesn't use 'arguments' identifier
|
||||
* and doesn't perform direct call to eval,
|
||||
@@ -271,12 +271,12 @@ ecma_op_create_function_object (ecma_collection_header_t *formal_params_collecti
|
||||
do_instantiate_arguments_object = false;
|
||||
}
|
||||
|
||||
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_ARGUMENTS_ON_REGISTERS)
|
||||
if (bytecode_header_p->is_args_moved_to_regs)
|
||||
{
|
||||
is_arguments_moved_to_regs = true;
|
||||
}
|
||||
|
||||
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_NO_LEX_ENV)
|
||||
if (bytecode_header_p->is_no_lex_env)
|
||||
{
|
||||
is_no_lex_env = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user