本文整理汇总了C++中ecma_is_value_undefined函数的典型用法代码示例。如果您正苦于以下问题:C++ ecma_is_value_undefined函数的具体用法?C++ ecma_is_value_undefined怎么用?C++ ecma_is_value_undefined使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ecma_is_value_undefined函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ecma_builtin_date_prototype_set_minutes
/**
* The Date.prototype object's 'setMinutes' routine
*
* See also:
* ECMA-262 v5, 15.9.5.32
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_date_prototype_set_minutes (ecma_value_t this_arg, /**< this argument */
const ecma_value_t args[], /**< arguments list */
ecma_length_t args_number) /**< number of arguments */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
/* 1. */
ECMA_TRY_CATCH (this_time_value, ecma_builtin_date_prototype_get_time (this_arg), ret_value);
ecma_number_t t = ecma_date_local_time (*ecma_get_number_from_value (this_time_value));
/* 2. */
ecma_number_t m = ecma_number_make_nan ();
ecma_number_t s = ecma_date_sec_from_time (t);
ecma_number_t milli = ecma_date_ms_from_time (t);
if (args_number > 0 && !ecma_is_value_undefined (args[0]))
{
ECMA_OP_TO_NUMBER_TRY_CATCH (min, args[0], ret_value);
m = min;
/* 3. */
if (args_number > 1 && !ecma_is_value_undefined (args[1]))
{
ECMA_OP_TO_NUMBER_TRY_CATCH (sec, args[1], ret_value);
s = sec;
/* 4. */
if (args_number > 2 && !ecma_is_value_undefined (args[2]))
{
ECMA_OP_TO_NUMBER_TRY_CATCH (ms, args[2], ret_value);
milli = ms;
ECMA_OP_TO_NUMBER_FINALIZE (ms);
}
ECMA_OP_TO_NUMBER_FINALIZE (sec);
}
ECMA_OP_TO_NUMBER_FINALIZE (min);
}
if (ecma_is_value_empty (ret_value))
{
/* 5-8. */
ecma_number_t hour = ecma_date_hour_from_time (t);
ret_value = ecma_date_set_internal_property (this_arg,
ecma_date_day (t),
ecma_date_make_time (hour, m, s, milli),
ECMA_DATE_LOCAL);
}
ECMA_FINALIZE (this_time_value);
return ret_value;
} /* ecma_builtin_date_prototype_set_minutes */
开发者ID:Akromx16,项目名称:jerryscript,代码行数:60,代码来源:ecma-builtin-date-prototype.c
示例2: ecma_op_to_object
/**
* ToObject operation.
*
* See also:
* ECMA-262 v5, 9.9
*
* @return ecma value
* Returned value must be freed with ecma_free_value
*/
ecma_value_t
ecma_op_to_object (ecma_value_t value) /**< ecma value */
{
ecma_check_value_type_is_spec_defined (value);
if (ecma_is_value_number (value))
{
return ecma_op_create_number_object (value);
}
else if (ecma_is_value_string (value))
{
return ecma_op_create_string_object (&value, 1);
}
else if (ecma_is_value_object (value))
{
return ecma_copy_value (value);
}
else
{
if (ecma_is_value_undefined (value)
|| ecma_is_value_null (value))
{
return ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (value));
return ecma_op_create_boolean_object (value);
}
}
} /* ecma_op_to_object */
开发者ID:vvreal,项目名称:jerryscript,代码行数:41,代码来源:ecma-conversion.c
示例3: ecma_builtin_date_prototype_set_utc_seconds
/**
* The Date.prototype object's 'setUTCSeconds' routine
*
* See also:
* ECMA-262 v5, 15.9.5.31
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_date_prototype_set_utc_seconds (ecma_value_t this_arg, /**< this argument */
ecma_value_t sec, /**< second */
ecma_value_t ms) /**< millisecond */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
/* 1. */
ECMA_TRY_CATCH (this_time_value, ecma_builtin_date_prototype_get_time (this_arg), ret_value);
ecma_number_t t = *ecma_get_number_from_value (this_time_value);
/* 2. */
ECMA_OP_TO_NUMBER_TRY_CATCH (s, sec, ret_value);
/* 3. */
ECMA_OP_TO_NUMBER_TRY_CATCH (milli, ms, ret_value);
if (ecma_is_value_undefined (ms))
{
milli = ecma_date_ms_from_time (t);
}
/* 4-7. */
ecma_number_t hour = ecma_date_hour_from_time (t);
ecma_number_t min = ecma_date_min_from_time (t);
ret_value = ecma_date_set_internal_property (this_arg,
ecma_date_day (t),
ecma_date_make_time (hour, min, s, milli),
ECMA_DATE_UTC);
ECMA_OP_TO_NUMBER_FINALIZE (milli);
ECMA_OP_TO_NUMBER_FINALIZE (s);
ECMA_FINALIZE (this_time_value);
return ret_value;
} /* ecma_builtin_date_prototype_set_utc_seconds */
开发者ID:Akromx16,项目名称:jerryscript,代码行数:44,代码来源:ecma-builtin-date-prototype.c
示例4: opfunc_relation
/**
* Relation opcode handler.
*
* See also: ECMA-262 v5, 11.8.1, 11.8.2, 11.8.3, 11.8.4
*
* @return ecma value
* Returned value must be freed with ecma_free_value
*/
ecma_value_t
opfunc_relation (ecma_value_t left_value, /**< left value */
ecma_value_t right_value, /**< right value */
bool left_first, /**< 'LeftFirst' flag */
bool is_invert) /**< is invert */
{
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
&& !ECMA_IS_VALUE_ERROR (right_value));
ecma_value_t ret_value = ecma_op_abstract_relational_compare (left_value, right_value, left_first);
if (ECMA_IS_VALUE_ERROR (ret_value))
{
return ret_value;
}
if (ecma_is_value_undefined (ret_value))
{
ret_value = ECMA_VALUE_FALSE;
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (ret_value));
if (is_invert)
{
ret_value = ecma_invert_boolean_value (ret_value);
}
}
return ret_value;
} /* opfunc_relation */
开发者ID:Samsung,项目名称:jerryscript,代码行数:40,代码来源:opcodes-ecma-relational-equality.c
示例5: ecma_builtin_date_prototype_set_utc_month
/**
* The Date.prototype object's 'setUTCMonth' routine
*
* See also:
* ECMA-262 v5, 15.9.5.39
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
ecma_builtin_date_prototype_set_utc_month (ecma_value_t this_arg, /**< this argument */
ecma_value_t month, /**< month */
ecma_value_t date) /**< date */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
/* 1. */
ECMA_TRY_CATCH (this_time_value, ecma_builtin_date_prototype_get_time (this_arg), ret_value);
ecma_number_t t = *ecma_get_number_from_value (this_time_value);
/* 2. */
ECMA_OP_TO_NUMBER_TRY_CATCH (m, month, ret_value);
/* 3. */
ECMA_OP_TO_NUMBER_TRY_CATCH (dt, date, ret_value);
if (ecma_is_value_undefined (date))
{
dt = ecma_date_date_from_time (t);
}
/* 4-7. */
ecma_number_t year = ecma_date_year_from_time (t);
ret_value = ecma_date_set_internal_property (this_arg,
ecma_date_make_day (year, m, dt),
ecma_date_time_within_day (t),
ECMA_DATE_UTC);
ECMA_OP_TO_NUMBER_FINALIZE (dt);
ECMA_OP_TO_NUMBER_FINALIZE (m);
ECMA_FINALIZE (this_time_value);
return ret_value;
} /* ecma_builtin_date_prototype_set_utc_month */
开发者ID:Akromx16,项目名称:jerryscript,代码行数:43,代码来源:ecma-builtin-date-prototype.c
示例6: ecma_builtin_helper_get_to_locale_string_at_index
/**
* The Array.prototype's 'toLocaleString' single element operation routine
*
* See also:
* ECMA-262 v5, 15.4.4.3 steps 6-8 and 10.b-d
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, /**< this object */
uint32_t index) /**< array index */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
ecma_string_t *index_string_p = ecma_new_ecma_string_from_uint32 (index);
ECMA_TRY_CATCH (index_value,
ecma_op_object_get (obj_p, index_string_p),
ret_value);
if (ecma_is_value_undefined (index_value) || ecma_is_value_null (index_value))
{
ecma_string_t *return_string_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
ret_value = ecma_make_string_value (return_string_p);
}
else
{
ECMA_TRY_CATCH (index_obj_value,
ecma_op_to_object (index_value),
ret_value);
ecma_object_t *index_obj_p = ecma_get_object_from_value (index_obj_value);
ecma_string_t *locale_string_magic_string_p = ecma_get_magic_string (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL);
ECMA_TRY_CATCH (to_locale_value,
ecma_op_object_get (index_obj_p, locale_string_magic_string_p),
ret_value);
if (ecma_op_is_callable (to_locale_value))
{
ecma_object_t *locale_func_obj_p = ecma_get_object_from_value (to_locale_value);
ECMA_TRY_CATCH (call_value,
ecma_op_function_call (locale_func_obj_p,
ecma_make_object_value (index_obj_p),
NULL,
0),
ret_value);
ret_value = ecma_op_to_string (call_value);
ECMA_FINALIZE (call_value);
}
else
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
ECMA_FINALIZE (to_locale_value);
ecma_deref_ecma_string (locale_string_magic_string_p);
ECMA_FINALIZE (index_obj_value);
}
ECMA_FINALIZE (index_value);
ecma_deref_ecma_string (index_string_p);
return ret_value;
} /* ecma_builtin_helper_get_to_locale_string_at_index */
开发者ID:gudbooy,项目名称:jerryscript,代码行数:69,代码来源:ecma-builtin-helpers.c
示例7: opfunc_greater_than
/**
* 'Greater-than' opcode handler.
*
* See also: ECMA-262 v5, 11.8.2
*
* @return ecma value
* Returned value must be freed with ecma_free_value
*/
ecma_value_t
opfunc_greater_than (ecma_value_t left_value, /**< left value */
ecma_value_t right_value) /**< right value */
{
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
&& !ECMA_IS_VALUE_ERROR (right_value));
ecma_value_t ret_value = ecma_op_abstract_relational_compare (left_value, right_value, false);
if (ECMA_IS_VALUE_ERROR (ret_value))
{
return ret_value;
}
if (ecma_is_value_undefined (ret_value))
{
ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_FALSE);
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (ret_value));
}
return ret_value;
} /* opfunc_greater_than */
开发者ID:drashti304,项目名称:TizenRT,代码行数:33,代码来源:opcodes-ecma-relational.c
示例8: ecma_op_to_object
/**
* ToObject operation.
*
* See also:
* ECMA-262 v5, 9.9
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_to_object (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
if (ecma_is_value_number (value))
{
return ecma_op_create_number_object (value);
}
else if (ecma_is_value_string (value))
{
return ecma_op_create_string_object (&value, 1);
}
else if (ecma_is_value_object (value))
{
return ecma_make_normal_completion_value (ecma_copy_value (value, true));
}
else
{
if (ecma_is_value_undefined (value)
|| ecma_is_value_null (value))
{
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (value));
return ecma_op_create_boolean_object (value);
}
}
} /* ecma_op_to_object */
开发者ID:kkristof,项目名称:jerryscript,代码行数:41,代码来源:ecma-conversion.cpp
示例9: ecma_builtin_syntax_error_dispatch_call
/**
* Handle calling [[Call]] of built-in SyntaxError object
*
* @return ecma value
*/
ecma_value_t
ecma_builtin_syntax_error_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
ecma_length_t arguments_list_len) /**< number of arguments */
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
if (arguments_list_len != 0
&& !ecma_is_value_undefined (arguments_list_p[0]))
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
ECMA_TRY_CATCH (msg_str_value,
ecma_op_to_string (arguments_list_p[0]),
ret_value);
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (ECMA_ERROR_SYNTAX,
message_string_p);
ret_value = ecma_make_object_value (new_error_object_p);
ECMA_FINALIZE (msg_str_value);
return ret_value;
}
else
{
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_SYNTAX);
return ecma_make_object_value (new_error_object_p);
}
} /* ecma_builtin_syntax_error_dispatch_call */
开发者ID:SmartFire,项目名称:jerryscript,代码行数:36,代码来源:ecma-builtin-syntaxerror.c
示例10: ecma_builtin_helper_error_dispatch_call
/**
* Handle calling [[Call]] of a built-in error object
*
* @return ecma value
*/
ecma_value_t
ecma_builtin_helper_error_dispatch_call (ecma_standard_error_t error_type, /**< native error type */
const ecma_value_t *arguments_list_p, /**< arguments list */
ecma_length_t arguments_list_len) /**< number of arguments */
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
if (arguments_list_len != 0
&& !ecma_is_value_undefined (arguments_list_p[0]))
{
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
ECMA_TRY_CATCH (msg_str_value,
ecma_op_to_string (arguments_list_p[0]),
ret_value);
ecma_string_t *message_string_p = ecma_get_string_from_value (msg_str_value);
ecma_object_t *new_error_object_p = ecma_new_standard_error_with_message (error_type,
message_string_p);
ret_value = ecma_make_object_value (new_error_object_p);
ECMA_FINALIZE (msg_str_value);
return ret_value;
}
else
{
ecma_object_t *new_error_object_p = ecma_new_standard_error (error_type);
return ecma_make_object_value (new_error_object_p);
}
} /* ecma_builtin_helper_error_dispatch_call */
开发者ID:Samsung,项目名称:jerryscript,代码行数:37,代码来源:ecma-builtin-helpers-error.c
示例11: ecma_op_to_string
/**
* ToString operation.
*
* See also:
* ECMA-262 v5, 9.8
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_to_string (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
if (unlikely (ecma_is_value_object (value)))
{
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
ECMA_TRY_CATCH (prim_value,
ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_STRING),
ret_value);
ret_value = ecma_op_to_string (prim_value);
ECMA_FINALIZE (prim_value);
return ret_value;
}
else
{
ecma_string_t *res_p = NULL;
if (ecma_is_value_string (value))
{
res_p = ecma_get_string_from_value (value);
res_p = ecma_copy_or_ref_ecma_string (res_p);
}
else if (ecma_is_value_number (value))
{
ecma_number_t *num_p = ecma_get_number_from_value (value);
res_p = ecma_new_ecma_string_from_number (*num_p);
}
else if (ecma_is_value_undefined (value))
{
res_p = ecma_get_magic_string (LIT_MAGIC_STRING_UNDEFINED);
}
else if (ecma_is_value_null (value))
{
res_p = ecma_get_magic_string (LIT_MAGIC_STRING_NULL);
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (value));
if (ecma_is_value_true (value))
{
res_p = ecma_get_magic_string (LIT_MAGIC_STRING_TRUE);
}
else
{
res_p = ecma_get_magic_string (LIT_MAGIC_STRING_FALSE);
}
}
return ecma_make_normal_completion_value (ecma_make_string_value (res_p));
}
} /* ecma_op_to_string */
开发者ID:kkristof,项目名称:jerryscript,代码行数:67,代码来源:ecma-conversion.cpp
示例12: ecma_check_value_type_is_spec_defined
/**
* Debug assertion that specified value's type is one of ECMA-defined
* script-visible types, i.e.: undefined, null, boolean, number, string, object.
*/
void
ecma_check_value_type_is_spec_defined (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_undefined (value)
|| ecma_is_value_null (value)
|| ecma_is_value_boolean (value)
|| ecma_is_value_number (value)
|| ecma_is_value_string (value)
|| ecma_is_value_object (value));
} /* ecma_check_value_type_is_spec_defined */
开发者ID:SmartFire,项目名称:jerryscript,代码行数:14,代码来源:ecma-helpers-value.c
示例13: vm_run_global
/**
* Run global code
*/
jerry_completion_code_t
vm_run_global (void)
{
JERRY_ASSERT (__program != NULL);
JERRY_ASSERT (vm_top_context_p == NULL);
#ifdef MEM_STATS
interp_mem_stats_print_legend ();
#endif /* MEM_STATS */
bool is_strict = false;
vm_instr_counter_t start_pos = 0;
opcode_scope_code_flags_t scope_flags = vm_get_scope_flags (__program,
start_pos++);
if (scope_flags & OPCODE_SCOPE_CODE_FLAGS_STRICT)
{
is_strict = true;
}
ecma_object_t *glob_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL);
ecma_object_t *lex_env_p = ecma_get_global_environment ();
ecma_completion_value_t completion = vm_run_from_pos (__program,
start_pos,
ecma_make_object_value (glob_obj_p),
lex_env_p,
is_strict,
false);
jerry_completion_code_t ret_code;
if (ecma_is_completion_value_return (completion))
{
JERRY_ASSERT (ecma_is_value_undefined (ecma_get_completion_value_value (completion)));
ret_code = JERRY_COMPLETION_CODE_OK;
}
else
{
JERRY_ASSERT (ecma_is_completion_value_throw (completion));
ret_code = JERRY_COMPLETION_CODE_UNHANDLED_EXCEPTION;
}
ecma_free_completion_value (completion);
ecma_deref_object (glob_obj_p);
ecma_deref_object (lex_env_p);
JERRY_ASSERT (vm_top_context_p == NULL);
return ret_code;
} /* vm_run_global */
开发者ID:szledan,项目名称:jerryscript,代码行数:58,代码来源:vm.cpp
示例14: ecma_op_to_boolean
/**
* ToBoolean operation.
*
* See also:
* ECMA-262 v5, 9.2
*
* @return completion value
* Returned value is simple and so need not be freed.
* However, ecma_free_completion_value may be called for it, but it is a no-op.
*/
ecma_completion_value_t
ecma_op_to_boolean (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
ecma_simple_value_t ret_value;
if (ecma_is_value_boolean (value))
{
ret_value = (ecma_is_value_true (value) ?
ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
}
else if (ecma_is_value_undefined (value)
|| ecma_is_value_null (value))
{
ret_value = ECMA_SIMPLE_VALUE_FALSE;
}
else if (ecma_is_value_number (value))
{
ecma_number_t *num_p = ecma_get_number_from_value (value);
if (ecma_number_is_nan (*num_p)
|| ecma_number_is_zero (*num_p))
{
ret_value = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
ret_value = ECMA_SIMPLE_VALUE_TRUE;
}
}
else if (ecma_is_value_string (value))
{
ecma_string_t *str_p = ecma_get_string_from_value (value);
if (ecma_string_get_length (str_p) == 0)
{
ret_value = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
ret_value = ECMA_SIMPLE_VALUE_TRUE;
}
}
else
{
JERRY_ASSERT (ecma_is_value_object (value));
ret_value = ECMA_SIMPLE_VALUE_TRUE;
}
return ecma_make_simple_completion_value (ret_value);
} /* ecma_op_to_boolean */
开发者ID:kkristof,项目名称:jerryscript,代码行数:63,代码来源:ecma-conversion.cpp
示例15: ecma_op_check_object_coercible
/**
* CheckObjectCoercible operation.
*
* See also:
* ECMA-262 v5, 9.10
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
ecma_op_check_object_coercible (ecma_value_t value) /**< ecma-value */
{
ecma_check_value_type_is_spec_defined (value);
if (ecma_is_value_undefined (value)
|| ecma_is_value_null (value))
{
return ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
return ecma_make_empty_completion_value ();
}
} /* ecma_op_check_object_coercible */
开发者ID:kkristof,项目名称:jerryscript,代码行数:24,代码来源:ecma-conversion.cpp
示例16: ecma_op_check_object_coercible
/**
* CheckObjectCoercible operation.
*
* See also:
* ECMA-262 v5, 9.10
*
* @return ecma value
* Returned value must be freed with ecma_free_value
*/
ecma_value_t
ecma_op_check_object_coercible (ecma_value_t value) /**< ecma value */
{
ecma_check_value_type_is_spec_defined (value);
if (ecma_is_value_undefined (value)
|| ecma_is_value_null (value))
{
return ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
return ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
}
} /* ecma_op_check_object_coercible */
开发者ID:vvreal,项目名称:jerryscript,代码行数:24,代码来源:ecma-conversion.c
示例17: opfunc_greater_or_equal_than
/**
* 'Greater-than-or-equal' opcode handler.
*
* See also: ECMA-262 v5, 11.8.4
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
opfunc_greater_or_equal_than (vm_instr_t instr, /**< instruction */
vm_frame_ctx_t *frame_ctx_p) /**< interpreter context */
{
const idx_t dst_var_idx = instr.data.greater_or_equal_than.dst;
const idx_t left_var_idx = instr.data.greater_or_equal_than.var_left;
const idx_t right_var_idx = instr.data.greater_or_equal_than.var_right;
//ilyushin
printf("greater_or_equal_than,");
//ilyushin
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
ECMA_TRY_CATCH (left_value, get_variable_value (frame_ctx_p, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (frame_ctx_p, right_var_idx, false), ret_value);
ECMA_TRY_CATCH (compare_result,
ecma_op_abstract_relational_compare (left_value, right_value, true),
ret_value);
ecma_simple_value_t res;
if (ecma_is_value_undefined (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
if (ecma_is_value_true (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
res = ECMA_SIMPLE_VALUE_TRUE;
}
}
ret_value = set_variable_value (frame_ctx_p, frame_ctx_p->pos, dst_var_idx, ecma_make_simple_value (res));
ECMA_FINALIZE (compare_result);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
frame_ctx_p->pos++;
return ret_value;
} /* opfunc_greater_or_equal_than */
开发者ID:Ilyushin,项目名称:jerryscript,代码行数:56,代码来源:opcodes-ecma-relational.cpp
示例18: ecma_builtin_object_object_create
/**
* The Object object's 'create' routine
*
* See also:
* ECMA-262 v5, 15.2.3.5
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value.
*/
static ecma_completion_value_t
ecma_builtin_object_object_create (ecma_value_t this_arg, /**< 'this' argument */
ecma_value_t arg1, /**< routine's first argument */
ecma_value_t arg2) /**< routine's second argument */
{
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
// 1.
if (!ecma_is_value_object (arg1) && !ecma_is_value_null (arg1))
{
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
}
else
{
ecma_object_t *obj_p = NULL;
if (!ecma_is_value_null (arg1))
{
obj_p = ecma_get_object_from_value (arg1);
}
// 2-3.
ecma_object_t *result_obj_p = ecma_op_create_object_object_noarg_and_set_prototype (obj_p);
// 4.
if (!ecma_is_value_undefined (arg2))
{
ECMA_TRY_CATCH (obj,
ecma_builtin_object_object_define_properties (this_arg,
ecma_make_object_value (result_obj_p),
arg2),
ret_value);
ECMA_FINALIZE (obj);
}
// 5.
if (ecma_is_completion_value_empty (ret_value))
{
ret_value = ecma_make_normal_completion_value (ecma_copy_value (ecma_make_object_value (result_obj_p),
true));
}
ecma_deref_object (result_obj_p);
}
return ret_value;
} /* ecma_builtin_object_object_create */
开发者ID:jiangrunwu,项目名称:iotjs-openwrt,代码行数:55,代码来源:ecma-builtin-object.cpp
示例19: opfunc_greater_or_equal_than
/**
* 'Greater-than-or-equal' opcode handler.
*
* See also: ECMA-262 v5, 11.8.4
*
* @return completion value
* Returned value must be freed with ecma_free_completion_value
*/
ecma_completion_value_t
opfunc_greater_or_equal_than (opcode_t opdata, /**< operation data */
int_data_t *int_data) /**< interpreter context */
{
const idx_t dst_var_idx = opdata.data.greater_or_equal_than.dst;
const idx_t left_var_idx = opdata.data.greater_or_equal_than.var_left;
const idx_t right_var_idx = opdata.data.greater_or_equal_than.var_right;
ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
ECMA_TRY_CATCH (left_value, get_variable_value (int_data, left_var_idx, false), ret_value);
ECMA_TRY_CATCH (right_value, get_variable_value (int_data, right_var_idx, false), ret_value);
ECMA_TRY_CATCH (compare_result,
ecma_op_abstract_relational_compare (left_value, right_value, true),
ret_value);
ecma_simple_value_t res;
if (ecma_is_value_undefined (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
JERRY_ASSERT (ecma_is_value_boolean (compare_result));
if (ecma_is_value_true (compare_result))
{
res = ECMA_SIMPLE_VALUE_FALSE;
}
else
{
res = ECMA_SIMPLE_VALUE_TRUE;
}
}
ret_value = set_variable_value (int_data, int_data->pos, dst_var_idx, ecma_make_simple_value (res));
ECMA_FINALIZE (compare_result);
ECMA_FINALIZE (right_value);
ECMA_FINALIZE (left_value);
int_data->pos++;
return ret_value;
} /* opfunc_greater_or_equal_than */
开发者ID:galpeter,项目名称:jerryscript_old,代码行数:54,代码来源:opcodes-ecma-relational.cpp
示例20: opfunc_typeof
/**
* 'typeof' opcode handler.
*
* See also: ECMA-262 v5, 11.4.3
*
* @return ecma value
* Returned value must be freed with ecma_free_value
*/
ecma_value_t
opfunc_typeof (ecma_value_t left_value) /**< left value */
{
ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
ecma_string_t *type_str_p = NULL;
if (ecma_is_value_undefined (left_value))
{
type_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_UNDEFINED);
}
else if (ecma_is_value_null (left_value))
{
type_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_OBJECT);
}
else if (ecma_is_value_boolean (left_value))
{
type_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_BOOLEAN);
}
else if (ecma_is_value_number (left_value))
{
type_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_NUMBER);
}
else if (ecma_is_value_string (left_value))
{
type_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_STRING);
}
else
{
JERRY_ASSERT (ecma_is_value_object (left_value));
if (ecma_op_is_callable (left_value))
{
type_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_FUNCTION);
}
else
{
type_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_OBJECT);
}
}
ret_value = ecma_make_string_value (type_str_p);
return ret_value;
} /* opfunc_typeof */
开发者ID:drashti304,项目名称:TizenRT,代码行数:53,代码来源:opcodes.c
注:本文中的ecma_is_value_undefined函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论