Introducing interp_bytecode_idx type for opcode indexes.
This commit is contained in:
@@ -46,7 +46,7 @@ run_int (void)
|
|||||||
{
|
{
|
||||||
JERRY_ASSERT( __program != NULL );
|
JERRY_ASSERT( __program != NULL );
|
||||||
|
|
||||||
const int start_pos = 0;
|
const interp_bytecode_idx start_pos = 0;
|
||||||
ecma_object_t *this_binding_p = NULL;
|
ecma_object_t *this_binding_p = NULL;
|
||||||
ecma_object_t *lex_env_p = ecma_create_lexical_environment (NULL,
|
ecma_object_t *lex_env_p = ecma_create_lexical_environment (NULL,
|
||||||
ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
|
ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
|
||||||
@@ -88,7 +88,7 @@ run_int (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ecma_completion_value_t
|
ecma_completion_value_t
|
||||||
run_int_from_pos (int start_pos,
|
run_int_from_pos (interp_bytecode_idx start_pos,
|
||||||
ecma_object_t *this_binding_p,
|
ecma_object_t *this_binding_p,
|
||||||
ecma_object_t *lex_env_p,
|
ecma_object_t *lex_env_p,
|
||||||
bool is_strict)
|
bool is_strict)
|
||||||
@@ -111,7 +111,7 @@ run_int_from_pos (int start_pos,
|
|||||||
JERRY_ASSERT( ecma_is_value_empty( regs[0]) );
|
JERRY_ASSERT( ecma_is_value_empty( regs[0]) );
|
||||||
|
|
||||||
struct __int_data int_data;
|
struct __int_data int_data;
|
||||||
int_data.pos = start_pos + 1;
|
int_data.pos = (interp_bytecode_idx) (start_pos + 1);
|
||||||
int_data.this_binding_p = this_binding_p;
|
int_data.this_binding_p = this_binding_p;
|
||||||
int_data.lex_env_p = lex_env_p;
|
int_data.lex_env_p = lex_env_p;
|
||||||
int_data.is_strict = is_strict;
|
int_data.is_strict = is_strict;
|
||||||
|
|||||||
@@ -20,9 +20,11 @@
|
|||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
#include "opcodes.h"
|
#include "opcodes.h"
|
||||||
|
|
||||||
|
typedef uint16_t interp_bytecode_idx;
|
||||||
|
|
||||||
struct __int_data
|
struct __int_data
|
||||||
{
|
{
|
||||||
int pos; /**< current opcode to execute */
|
interp_bytecode_idx pos; /**< current opcode to execute */
|
||||||
ecma_object_t *this_binding_p; /**< this binding for current context */
|
ecma_object_t *this_binding_p; /**< this binding for current context */
|
||||||
ecma_object_t *lex_env_p; /**< current lexical environment */
|
ecma_object_t *lex_env_p; /**< current lexical environment */
|
||||||
bool is_strict; /**< is current code execution mode strict? */
|
bool is_strict; /**< is current code execution mode strict? */
|
||||||
@@ -33,7 +35,7 @@ struct __int_data
|
|||||||
|
|
||||||
void init_int (const OPCODE* program_p);
|
void init_int (const OPCODE* program_p);
|
||||||
bool run_int (void);
|
bool run_int (void);
|
||||||
ecma_completion_value_t run_int_from_pos (int start_pos,
|
ecma_completion_value_t run_int_from_pos (interp_bytecode_idx start_pos,
|
||||||
ecma_object_t *this_binding_p,
|
ecma_object_t *this_binding_p,
|
||||||
ecma_object_t *lex_env_p,
|
ecma_object_t *lex_env_p,
|
||||||
bool is_strict);
|
bool is_strict);
|
||||||
|
|||||||
@@ -564,7 +564,9 @@ ecma_completion_value_t
|
|||||||
opfunc_jmp_down (OPCODE opdata, /**< operation data */
|
opfunc_jmp_down (OPCODE opdata, /**< operation data */
|
||||||
struct __int_data *int_data) /**< interpreter context */
|
struct __int_data *int_data) /**< interpreter context */
|
||||||
{
|
{
|
||||||
int_data->pos += opdata.data.jmp_down.opcode_count;
|
JERRY_ASSERT( int_data->pos <= int_data->pos + opdata.data.jmp_up.opcode_count );
|
||||||
|
|
||||||
|
int_data->pos = (interp_bytecode_idx) ( int_data->pos + opdata.data.jmp_down.opcode_count );
|
||||||
|
|
||||||
return ecma_make_empty_completion_value();
|
return ecma_make_empty_completion_value();
|
||||||
} /* opfunc_jmp_down */
|
} /* opfunc_jmp_down */
|
||||||
@@ -579,9 +581,9 @@ ecma_completion_value_t
|
|||||||
opfunc_jmp_up (OPCODE opdata, /**< operation data */
|
opfunc_jmp_up (OPCODE opdata, /**< operation data */
|
||||||
struct __int_data *int_data) /**< interpreter context */
|
struct __int_data *int_data) /**< interpreter context */
|
||||||
{
|
{
|
||||||
int_data->pos -= opdata.data.jmp_up.opcode_count;
|
JERRY_ASSERT( int_data->pos >= opdata.data.jmp_up.opcode_count );
|
||||||
|
|
||||||
JERRY_ASSERT( int_data->pos >= 0 );
|
int_data->pos = (interp_bytecode_idx) ( int_data->pos - opdata.data.jmp_down.opcode_count );
|
||||||
|
|
||||||
return ecma_make_empty_completion_value();
|
return ecma_make_empty_completion_value();
|
||||||
} /* opfunc_jmp_up */
|
} /* opfunc_jmp_up */
|
||||||
|
|||||||
Reference in New Issue
Block a user