Formatting fixes in libcoreint
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
#ifndef OPCODE_STRUCTURES_H
|
#ifndef OPCODE_STRUCTURES_H
|
||||||
#define OPCODE_STRUCTURES_H
|
#define OPCODE_STRUCTURES_H
|
||||||
|
|
||||||
// Jerry bytecode ver:07/04/2014
|
|
||||||
#define OP_DEF(name, list) struct __op_##name { list ; } ;
|
#define OP_DEF(name, list) struct __op_##name { list ; } ;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,14 +40,16 @@
|
|||||||
T_IDX_DECL (name3)
|
T_IDX_DECL (name3)
|
||||||
|
|
||||||
#define GETOP_IMPL_0(name) \
|
#define GETOP_IMPL_0(name) \
|
||||||
OPCODE getop_##name () { \
|
OPCODE getop_##name () \
|
||||||
|
{ \
|
||||||
OPCODE opdata; \
|
OPCODE opdata; \
|
||||||
opdata.op_idx = __op__idx_##name; \
|
opdata.op_idx = __op__idx_##name; \
|
||||||
return opdata; \
|
return opdata; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define GETOP_IMPL_1(name, field1) \
|
#define GETOP_IMPL_1(name, field1) \
|
||||||
OPCODE getop_##name (T_IDX arg1) { \
|
OPCODE getop_##name (T_IDX arg1) \
|
||||||
|
{ \
|
||||||
OPCODE opdata; \
|
OPCODE opdata; \
|
||||||
opdata.op_idx = __op__idx_##name; \
|
opdata.op_idx = __op__idx_##name; \
|
||||||
opdata.data.name.field1 = arg1; \
|
opdata.data.name.field1 = arg1; \
|
||||||
@@ -56,7 +57,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define GETOP_IMPL_2(name, field1, field2) \
|
#define GETOP_IMPL_2(name, field1, field2) \
|
||||||
OPCODE getop_##name (T_IDX arg1, T_IDX arg2) { \
|
OPCODE getop_##name (T_IDX arg1, T_IDX arg2) \
|
||||||
|
{ \
|
||||||
OPCODE opdata; \
|
OPCODE opdata; \
|
||||||
opdata.op_idx = __op__idx_##name; \
|
opdata.op_idx = __op__idx_##name; \
|
||||||
opdata.data.name.field1 = arg1; \
|
opdata.data.name.field1 = arg1; \
|
||||||
@@ -65,7 +67,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define GETOP_IMPL_3(name, field1, field2, field3) \
|
#define GETOP_IMPL_3(name, field1, field2, field3) \
|
||||||
OPCODE getop_##name (T_IDX arg1, T_IDX arg2, T_IDX arg3) { \
|
OPCODE getop_##name (T_IDX arg1, T_IDX arg2, T_IDX arg3) \
|
||||||
|
{ \
|
||||||
OPCODE opdata; \
|
OPCODE opdata; \
|
||||||
opdata.op_idx = __op__idx_##name; \
|
opdata.op_idx = __op__idx_##name; \
|
||||||
opdata.data.name.field1 = arg1; \
|
opdata.data.name.field1 = arg1; \
|
||||||
@@ -487,4 +490,3 @@ OP_CODE_DECL (reg_var_decl, T_IDX_IDX,
|
|||||||
|
|
||||||
|
|
||||||
#endif /* OPCODE_STRUCTURES_H */
|
#endif /* OPCODE_STRUCTURES_H */
|
||||||
|
|
||||||
|
|||||||
@@ -139,8 +139,10 @@ do_strict_eval_arguments_check( ecma_reference_t ref) /**< ECMA-reference */
|
|||||||
{
|
{
|
||||||
FIXME (Replace strcmp with ecma_char_t[] comparator);
|
FIXME (Replace strcmp with ecma_char_t[] comparator);
|
||||||
return (ref.is_strict
|
return (ref.is_strict
|
||||||
&& ( __strcmp( (char*)ref.referenced_name_p, (char*)ecma_get_magic_string( ECMA_MAGIC_STRING_EVAL)) == 0
|
&& (__strcmp ((char*) ref.referenced_name_p,
|
||||||
|| __strcmp( (char*)ref.referenced_name_p, (char*)ecma_get_magic_string( ECMA_MAGIC_STRING_ARGUMENTS)) == 0 )
|
(char*) ecma_get_magic_string (ECMA_MAGIC_STRING_EVAL)) == 0
|
||||||
|
|| __strcmp ((char*) ref.referenced_name_p,
|
||||||
|
(char*) ecma_get_magic_string (ECMA_MAGIC_STRING_ARGUMENTS)) == 0)
|
||||||
&& (ref.base.value_type == ECMA_TYPE_OBJECT)
|
&& (ref.base.value_type == ECMA_TYPE_OBJECT)
|
||||||
&& (ECMA_GET_POINTER (ref.base.value) != NULL)
|
&& (ECMA_GET_POINTER (ref.base.value) != NULL)
|
||||||
&& (((ecma_object_t*) ECMA_GET_POINTER (ref.base.value))->is_lexical_environment));
|
&& (((ecma_object_t*) ECMA_GET_POINTER (ref.base.value))->is_lexical_environment));
|
||||||
@@ -295,21 +297,31 @@ do_number_arithmetic(struct __int_data *int_data, /**< interpreter context */
|
|||||||
switch (op)
|
switch (op)
|
||||||
{
|
{
|
||||||
case number_arithmetic_addition:
|
case number_arithmetic_addition:
|
||||||
|
{
|
||||||
*res_p = ecma_op_number_add (*left_p, *right_p);
|
*res_p = ecma_op_number_add (*left_p, *right_p);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case number_arithmetic_substraction:
|
case number_arithmetic_substraction:
|
||||||
|
{
|
||||||
*res_p = ecma_op_number_substract (*left_p, *right_p);
|
*res_p = ecma_op_number_substract (*left_p, *right_p);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case number_arithmetic_multiplication:
|
case number_arithmetic_multiplication:
|
||||||
|
{
|
||||||
*res_p = ecma_op_number_multiply (*left_p, *right_p);
|
*res_p = ecma_op_number_multiply (*left_p, *right_p);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case number_arithmetic_division:
|
case number_arithmetic_division:
|
||||||
|
{
|
||||||
*res_p = ecma_op_number_divide (*left_p, *right_p);
|
*res_p = ecma_op_number_divide (*left_p, *right_p);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case number_arithmetic_remainder:
|
case number_arithmetic_remainder:
|
||||||
|
{
|
||||||
*res_p = ecma_op_number_remainder (*left_p, *right_p);
|
*res_p = ecma_op_number_remainder (*left_p, *right_p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ret_value = set_variable_value (int_data,
|
ret_value = set_variable_value (int_data,
|
||||||
dst_var_idx,
|
dst_var_idx,
|
||||||
@@ -375,9 +387,11 @@ do_number_arithmetic(struct __int_data *int_data, /**< interpreter context */
|
|||||||
static char __unused unimplemented_list_end
|
static char __unused unimplemented_list_end
|
||||||
|
|
||||||
#define DEFINE_UNIMPLEMENTED_OP(op) \
|
#define DEFINE_UNIMPLEMENTED_OP(op) \
|
||||||
ecma_completion_value_t opfunc_ ## op(OPCODE opdata, struct __int_data *int_data) { \
|
ecma_completion_value_t opfunc_ ## op (OPCODE opdata, struct __int_data *int_data) \
|
||||||
|
{ \
|
||||||
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS (opdata, int_data); \
|
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS (opdata, int_data); \
|
||||||
}
|
}
|
||||||
|
|
||||||
OP_UNIMPLEMENTED_LIST (DEFINE_UNIMPLEMENTED_OP);
|
OP_UNIMPLEMENTED_LIST (DEFINE_UNIMPLEMENTED_OP);
|
||||||
#undef DEFINE_UNIMPLEMENTED_OP
|
#undef DEFINE_UNIMPLEMENTED_OP
|
||||||
|
|
||||||
@@ -686,6 +700,7 @@ opfunc_assignment (OPCODE opdata, /**< operation data */
|
|||||||
ECMA_TARGET_ID_RESERVED);
|
ECMA_TARGET_ID_RESERVED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
JERRY_UNIMPLEMENTED ();
|
JERRY_UNIMPLEMENTED ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1290,7 +1305,8 @@ opfunc_var_decl(OPCODE opdata, /**< operation data */
|
|||||||
if (ecma_is_completion_value_normal_false (ecma_op_has_binding (int_data->lex_env_p,
|
if (ecma_is_completion_value_normal_false (ecma_op_has_binding (int_data->lex_env_p,
|
||||||
variable_name.str_p)))
|
variable_name.str_p)))
|
||||||
{
|
{
|
||||||
FIXME( Pass configurableBindings that is true if and only if current code is eval code );
|
FIXME ("Pass configurableBindings that is true if and only if current code is eval code");
|
||||||
|
|
||||||
ecma_completion_value_t completion = ecma_op_create_mutable_binding (int_data->lex_env_p,
|
ecma_completion_value_t completion = ecma_op_create_mutable_binding (int_data->lex_env_p,
|
||||||
variable_name.str_p,
|
variable_name.str_p,
|
||||||
false);
|
false);
|
||||||
@@ -1328,7 +1344,7 @@ opfunc_func_decl_0(OPCODE opdata, /**< operation data */
|
|||||||
string_literal_copy function_name;
|
string_literal_copy function_name;
|
||||||
init_string_literal_copy (opdata.data.func_decl_0.name_lit_idx, &function_name);
|
init_string_literal_copy (opdata.data.func_decl_0.name_lit_idx, &function_name);
|
||||||
|
|
||||||
TODO( Check if code of function itself is strict );
|
TODO ("Check if code of function itself is strict");
|
||||||
|
|
||||||
const bool is_strict = int_data->is_strict;
|
const bool is_strict = int_data->is_strict;
|
||||||
|
|
||||||
@@ -1362,7 +1378,8 @@ opfunc_func_decl_0(OPCODE opdata, /**< operation data */
|
|||||||
// d.
|
// d.
|
||||||
if (!func_already_declared)
|
if (!func_already_declared)
|
||||||
{
|
{
|
||||||
FIXME( Pass configurableBindings that is true if and only if current code is eval code );
|
FIXME ("Pass configurableBindings that is true if and only if current code is eval code");
|
||||||
|
|
||||||
ecma_completion_value_t completion = ecma_op_create_mutable_binding (int_data->lex_env_p,
|
ecma_completion_value_t completion = ecma_op_create_mutable_binding (int_data->lex_env_p,
|
||||||
fn,
|
fn,
|
||||||
false);
|
false);
|
||||||
@@ -1371,7 +1388,7 @@ opfunc_func_decl_0(OPCODE opdata, /**< operation data */
|
|||||||
}
|
}
|
||||||
|
|
||||||
// e.
|
// e.
|
||||||
TODO( Check if current lexical environment is global environment and implement the case );
|
TODO ("Check if current lexical environment is global environment and implement the case");
|
||||||
|
|
||||||
// f.
|
// f.
|
||||||
ecma_completion_value_t ret_value = ecma_op_set_mutable_binding (int_data->lex_env_p, fn, fo_value, is_strict);
|
ecma_completion_value_t ret_value = ecma_op_set_mutable_binding (int_data->lex_env_p, fn, fo_value, is_strict);
|
||||||
@@ -1384,7 +1401,7 @@ opfunc_func_decl_0(OPCODE opdata, /**< operation data */
|
|||||||
} /* opfunc_func_decl_0 */
|
} /* opfunc_func_decl_0 */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'Function call with no arguments' opcode handler.
|
* Function call with no arguments' opcode handler.
|
||||||
*
|
*
|
||||||
* See also: ECMA-262 v5, 11.2.3
|
* See also: ECMA-262 v5, 11.2.3
|
||||||
*
|
*
|
||||||
@@ -1555,4 +1572,3 @@ GETOP_IMPL_2 (typeof, lhs, obj)
|
|||||||
GETOP_IMPL_1 (with, expr)
|
GETOP_IMPL_1 (with, expr)
|
||||||
GETOP_IMPL_0 (end_with)
|
GETOP_IMPL_0 (end_with)
|
||||||
GETOP_IMPL_2 (reg_var_decl, min, max)
|
GETOP_IMPL_2 (reg_var_decl, min, max)
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ struct __int_data;
|
|||||||
#define T_IDX uint8_t /** index values */
|
#define T_IDX uint8_t /** index values */
|
||||||
|
|
||||||
OPCODE;
|
OPCODE;
|
||||||
typedef ecma_completion_value_t (*opfunc)(OPCODE, struct __int_data *);
|
typedef
|
||||||
|
ecma_completion_value_t (*opfunc) (OPCODE, struct __int_data *);
|
||||||
|
|
||||||
#define OP_CALLS_AND_ARGS(op) \
|
#define OP_CALLS_AND_ARGS(op) \
|
||||||
op (call_0) \
|
op (call_0) \
|
||||||
@@ -181,4 +182,3 @@ typedef enum
|
|||||||
} opcode_arg_type_operand;
|
} opcode_arg_type_operand;
|
||||||
|
|
||||||
#endif /* OPCODES_H */
|
#endif /* OPCODES_H */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user