Moving to replacement of on-stack ecma_object_t* with managed ecma_object_ptr_t.
This commit is contained in:
+5
-1
@@ -37,7 +37,11 @@ typedef unsigned long mword_t;
|
||||
#define __noinline __attribute__((noinline))
|
||||
#define __used __attribute__((used))
|
||||
#ifndef __attribute_always_inline__
|
||||
# define __attribute_always_inline__ __attribute__((always_inline))
|
||||
# ifdef JERRY_NDEBUG
|
||||
# define __attribute_always_inline__ __attribute__((always_inline))
|
||||
# else /* !JERRY_NDEBUG */
|
||||
# define __attribute_always_inline__
|
||||
# endif /* !JERRY_NDEBUG */
|
||||
#endif /* !__attribute_always_inline__ */
|
||||
#ifndef __attribute_const__
|
||||
# define __attribute_const__ __attribute__((const))
|
||||
|
||||
@@ -367,9 +367,11 @@ run_int (void)
|
||||
|
||||
ecma_init ();
|
||||
|
||||
ecma_object_t *glob_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL);
|
||||
ecma_object_ptr_t glob_obj_p;
|
||||
ecma_builtin_get (glob_obj_p, ECMA_BUILTIN_ID_GLOBAL);
|
||||
|
||||
ecma_object_t *lex_env_p = ecma_op_create_global_environment (glob_obj_p);
|
||||
ecma_object_ptr_t lex_env_p;
|
||||
ecma_op_create_global_environment (lex_env_p, glob_obj_p);
|
||||
ecma_value_t this_binding_value (glob_obj_p);
|
||||
|
||||
ecma_completion_value_t run_completion;
|
||||
@@ -452,7 +454,7 @@ void
|
||||
run_int_from_pos (ecma_completion_value_t &completion, /**< out: completion value */
|
||||
opcode_counter_t start_pos, /**< position to start interpretation at */
|
||||
const ecma_value_t& this_binding_value, /**< value of 'this' binding */
|
||||
ecma_object_t *lex_env_p, /**< starting lexical environment */
|
||||
const ecma_object_ptr_t& lex_env_p, /**< starting lexical environment */
|
||||
bool is_strict, /**< is execution mode strict? */
|
||||
bool is_eval_code) /**< is current code executed with eval? */
|
||||
{
|
||||
@@ -470,7 +472,7 @@ run_int_from_pos (ecma_completion_value_t &completion, /**< out: completion valu
|
||||
int_data_t int_data;
|
||||
int_data.pos = (opcode_counter_t) (start_pos + 1);
|
||||
int_data.this_binding_p = &this_binding_value;
|
||||
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_eval_code = is_eval_code;
|
||||
int_data.min_reg_num = min_reg_num;
|
||||
|
||||
@@ -28,7 +28,7 @@ void run_int_loop (ecma_completion_value_t &ret_value,
|
||||
void run_int_from_pos (ecma_completion_value_t &ret_value,
|
||||
opcode_counter_t start_pos,
|
||||
const ecma_value_t& this_binding_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
const ecma_object_ptr_t& lex_env_p,
|
||||
bool is_strict,
|
||||
bool is_eval_code);
|
||||
|
||||
|
||||
@@ -224,11 +224,14 @@ opfunc_instanceof (ecma_completion_value_t &ret_value, /**< out: completion valu
|
||||
|
||||
if (!ecma_is_value_object (right_value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
|
||||
ecma_object_ptr_t right_value_obj_p;
|
||||
ecma_get_object_from_value (right_value_obj_p, right_value);
|
||||
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_has_instance, is_instance_of, right_value_obj_p, left_value);
|
||||
|
||||
@@ -265,7 +268,9 @@ opfunc_in (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
|
||||
if (!ecma_is_value_object (right_value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -273,7 +278,8 @@ opfunc_in (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
|
||||
ecma_simple_value_t is_in = ECMA_SIMPLE_VALUE_UNDEFINED;
|
||||
ecma_string_t *left_value_prop_name_p = ecma_get_string_from_value (str_left_value);
|
||||
ecma_object_t *right_value_obj_p = ecma_get_object_from_value (right_value);
|
||||
ecma_object_ptr_t right_value_obj_p;
|
||||
ecma_get_object_from_value (right_value_obj_p, right_value);
|
||||
|
||||
if (ecma_op_object_get_property (right_value_obj_p, left_value_prop_name_p) != NULL)
|
||||
{
|
||||
|
||||
@@ -70,8 +70,9 @@ opfunc_try_block (ecma_completion_value_t &try_completion, /**< out: completion
|
||||
|
||||
ecma_string_t *catch_exc_var_name_str_p = ecma_new_ecma_string_from_lit_index (catch_exc_val_var_name_lit_idx);
|
||||
|
||||
ecma_object_t *old_env_p = int_data->lex_env_p;
|
||||
ecma_object_t *catch_env_p = ecma_create_decl_lex_env (old_env_p);
|
||||
const ecma_object_ptr_t* old_env_p = int_data->lex_env_p;
|
||||
ecma_object_ptr_t catch_env_p;
|
||||
ecma_create_decl_lex_env (catch_env_p, *old_env_p);
|
||||
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_create_mutable_binding (completion,
|
||||
@@ -92,7 +93,7 @@ opfunc_try_block (ecma_completion_value_t &try_completion, /**< out: completion
|
||||
|
||||
ecma_deref_ecma_string (catch_exc_var_name_str_p);
|
||||
|
||||
int_data->lex_env_p = catch_env_p;
|
||||
int_data->lex_env_p = &catch_env_p;
|
||||
|
||||
ecma_free_completion_value (try_completion);
|
||||
run_int_loop (try_completion, int_data);
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
* but has no ECMA-defined name.
|
||||
*/
|
||||
static void
|
||||
do_strict_eval_arguments_check (ecma_object_t *ref_base_lex_env_p, /**< base of ECMA-reference
|
||||
(lexical environment) */
|
||||
do_strict_eval_arguments_check (const ecma_object_ptr_t &ref_base_lex_env_p, /**< base of ECMA-reference
|
||||
(lexical environment) */
|
||||
ecma_string_t *var_name_string_p, /**< variable name */
|
||||
bool is_strict) /**< flag indicating strict mode */
|
||||
{
|
||||
@@ -31,7 +31,7 @@ do_strict_eval_arguments_check (ecma_object_t *ref_base_lex_env_p, /**< base of
|
||||
|
||||
if (is_strict)
|
||||
{
|
||||
if (ref_base_lex_env_p != NULL)
|
||||
if (ref_base_lex_env_p.is_not_null ())
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (ref_base_lex_env_p));
|
||||
|
||||
@@ -99,8 +99,8 @@ get_variable_value (ecma_completion_value_t &ret_value, /**< out: completion val
|
||||
JERRY_ASSERT (lit_id != INVALID_LITERAL);
|
||||
ecma_new_ecma_string_on_stack_from_lit_index (&var_name_string, lit_id);
|
||||
|
||||
ecma_object_t *ref_base_lex_env_p = ecma_op_resolve_reference_base (int_data->lex_env_p,
|
||||
&var_name_string);
|
||||
ecma_object_ptr_t ref_base_lex_env_p;
|
||||
ecma_op_resolve_reference_base (ref_base_lex_env_p, *int_data->lex_env_p, &var_name_string);
|
||||
|
||||
if (do_eval_or_arguments_check)
|
||||
{
|
||||
@@ -169,8 +169,8 @@ set_variable_value (ecma_completion_value_t &ret_value, /**< out: completion val
|
||||
JERRY_ASSERT (lit_id != INVALID_LITERAL);
|
||||
ecma_new_ecma_string_on_stack_from_lit_index (&var_name_string, lit_id);
|
||||
|
||||
ecma_object_t *ref_base_lex_env_p = ecma_op_resolve_reference_base (int_data->lex_env_p,
|
||||
&var_name_string);
|
||||
ecma_object_ptr_t ref_base_lex_env_p;
|
||||
ecma_op_resolve_reference_base (ref_base_lex_env_p, *int_data->lex_env_p, &var_name_string);
|
||||
|
||||
#ifndef JERRY_NDEBUG
|
||||
do_strict_eval_arguments_check (ref_base_lex_env_p,
|
||||
|
||||
+50
-32
@@ -383,13 +383,13 @@ opfunc_var_decl (ecma_completion_value_t &ret_value, /**< out: completion value
|
||||
|
||||
ecma_string_t *var_name_string_p = ecma_new_ecma_string_from_lit_index (lit_id);
|
||||
|
||||
if (!ecma_op_has_binding (int_data->lex_env_p, var_name_string_p))
|
||||
if (!ecma_op_has_binding (*int_data->lex_env_p, var_name_string_p))
|
||||
{
|
||||
const bool is_configurable_bindings = int_data->is_eval_code;
|
||||
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_create_mutable_binding (completion,
|
||||
int_data->lex_env_p,
|
||||
*int_data->lex_env_p,
|
||||
var_name_string_p,
|
||||
is_configurable_bindings);
|
||||
|
||||
@@ -399,7 +399,7 @@ opfunc_var_decl (ecma_completion_value_t &ret_value, /**< out: completion value
|
||||
* any binding with specified name in current lexical environment
|
||||
* and CreateMutableBinding sets the created binding's value to undefined */
|
||||
ecma_op_get_binding_value (completion,
|
||||
int_data->lex_env_p,
|
||||
*int_data->lex_env_p,
|
||||
var_name_string_p,
|
||||
true);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_simple_value (completion, ECMA_SIMPLE_VALUE_UNDEFINED));
|
||||
@@ -445,7 +445,7 @@ function_declaration (ecma_completion_value_t &ret_value, /**< out: completion v
|
||||
ecma_string_t *function_name_string_p = ecma_new_ecma_string_from_lit_index (function_name_lit_id);
|
||||
|
||||
ecma_op_function_declaration (ret_value,
|
||||
int_data->lex_env_p,
|
||||
*int_data->lex_env_p,
|
||||
function_name_string_p,
|
||||
int_data->pos,
|
||||
args_names,
|
||||
@@ -537,11 +537,11 @@ opfunc_func_expr_n (ecma_completion_value_t &ret_value, /**< out: completion val
|
||||
int_data->pos++;
|
||||
}
|
||||
|
||||
ecma_object_t *scope_p;
|
||||
ecma_object_ptr_t scope_p;
|
||||
ecma_string_t *function_name_string_p = NULL;
|
||||
if (is_named_func_expr)
|
||||
{
|
||||
scope_p = ecma_create_decl_lex_env (int_data->lex_env_p);
|
||||
ecma_create_decl_lex_env (scope_p, *int_data->lex_env_p);
|
||||
|
||||
const literal_index_t lit_id = deserialize_lit_id_by_uid (function_name_lit_idx, lit_oc);
|
||||
JERRY_ASSERT (lit_id != INVALID_LITERAL);
|
||||
@@ -552,15 +552,17 @@ opfunc_func_expr_n (ecma_completion_value_t &ret_value, /**< out: completion val
|
||||
}
|
||||
else
|
||||
{
|
||||
scope_p = int_data->lex_env_p;
|
||||
scope_p = *int_data->lex_env_p;
|
||||
ecma_ref_object (scope_p);
|
||||
}
|
||||
|
||||
ecma_object_t *func_obj_p = ecma_op_create_function_object (params_names,
|
||||
params_number,
|
||||
scope_p,
|
||||
is_strict,
|
||||
int_data->pos);
|
||||
ecma_object_ptr_t func_obj_p;
|
||||
ecma_op_create_function_object (func_obj_p,
|
||||
params_names,
|
||||
params_number,
|
||||
scope_p,
|
||||
is_strict,
|
||||
int_data->pos);
|
||||
|
||||
set_variable_value (ret_value, int_data, lit_oc, dst_var_idx, ecma_value_t (func_obj_p));
|
||||
|
||||
@@ -654,7 +656,7 @@ opfunc_call_n (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_op_implicit_this_value (get_this_completion_value, int_data->lex_env_p);
|
||||
ecma_op_implicit_this_value (get_this_completion_value, *int_data->lex_env_p);
|
||||
}
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal (get_this_completion_value));
|
||||
|
||||
@@ -663,11 +665,14 @@ opfunc_call_n (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
|
||||
if (!ecma_op_is_callable (func_value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *func_obj_p = ecma_get_object_from_value (func_value);
|
||||
ecma_object_ptr_t func_obj_p;
|
||||
ecma_get_object_from_value (func_obj_p, func_value);
|
||||
|
||||
ECMA_TRY_CATCH (ret_value,
|
||||
ecma_op_function_call, call_ret_value, func_obj_p, this_value, arg_values, args_number);
|
||||
@@ -736,11 +741,14 @@ opfunc_construct_n (ecma_completion_value_t &ret_value, /**< out: completion val
|
||||
|
||||
if (!ecma_is_constructor (constructor_value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor_value);
|
||||
ecma_object_ptr_t constructor_obj_p;
|
||||
ecma_get_object_from_value (constructor_obj_p, constructor_value);
|
||||
|
||||
ECMA_TRY_CATCH (ret_value,
|
||||
ecma_op_function_construct, construction_ret_value, constructor_obj_p, arg_values, args_number);
|
||||
@@ -846,7 +854,8 @@ opfunc_obj_decl (ecma_completion_value_t &ret_value, /**< out: completion value
|
||||
int_data->pos++;
|
||||
|
||||
ecma_completion_value_t completion;
|
||||
ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_op_create_object_object_noarg (obj_p);
|
||||
|
||||
for (uint32_t prop_index = 0;
|
||||
prop_index < args_number;
|
||||
@@ -927,7 +936,9 @@ opfunc_obj_decl (ecma_completion_value_t &ret_value, /**< out: completion value
|
||||
else if (type == OPCODE_META_TYPE_VARG_PROP_GETTER)
|
||||
{
|
||||
prop_desc.is_get_defined = true;
|
||||
prop_desc.get_p = ecma_get_object_from_value (value_for_prop_desc);
|
||||
ecma_object_ptr_t get_p;
|
||||
ecma_get_object_from_value (get_p, value_for_prop_desc);
|
||||
prop_desc.get_p = (ecma_object_t*) get_p;
|
||||
|
||||
if (!is_previous_undefined
|
||||
&& is_previous_data_desc)
|
||||
@@ -938,7 +949,9 @@ opfunc_obj_decl (ecma_completion_value_t &ret_value, /**< out: completion value
|
||||
else
|
||||
{
|
||||
prop_desc.is_set_defined = true;
|
||||
prop_desc.set_p = ecma_get_object_from_value (value_for_prop_desc);
|
||||
ecma_object_ptr_t set_p;
|
||||
ecma_get_object_from_value (set_p, value_for_prop_desc);
|
||||
prop_desc.set_p = (ecma_object_t*) set_p;
|
||||
|
||||
if (!is_previous_undefined
|
||||
&& is_previous_data_desc)
|
||||
@@ -1223,13 +1236,16 @@ opfunc_with (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
|
||||
int_data->pos++;
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_expr_value);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, obj_expr_value);
|
||||
|
||||
ecma_object_t *old_env_p = int_data->lex_env_p;
|
||||
ecma_object_t *new_env_p = ecma_create_object_lex_env (old_env_p,
|
||||
obj_p,
|
||||
true);
|
||||
int_data->lex_env_p = new_env_p;
|
||||
const ecma_object_ptr_t* old_env_p = int_data->lex_env_p;
|
||||
ecma_object_ptr_t new_env_p;
|
||||
ecma_create_object_lex_env (new_env_p,
|
||||
*old_env_p,
|
||||
obj_p,
|
||||
true);
|
||||
int_data->lex_env_p = &new_env_p;
|
||||
|
||||
ecma_completion_value_t evaluation_completion;
|
||||
run_int_loop (evaluation_completion, int_data);
|
||||
@@ -1315,9 +1331,9 @@ evaluate_arg_for_typeof (ecma_completion_value_t &ret_value, /**< out: completio
|
||||
|
||||
ecma_string_t *var_name_string_p = ecma_new_ecma_string_from_lit_index (lit_id);
|
||||
|
||||
ecma_object_t *ref_base_lex_env_p = ecma_op_resolve_reference_base (int_data->lex_env_p,
|
||||
var_name_string_p);
|
||||
if (ref_base_lex_env_p == NULL)
|
||||
ecma_object_ptr_t ref_base_lex_env_p;
|
||||
ecma_op_resolve_reference_base (ref_base_lex_env_p, *int_data->lex_env_p, var_name_string_p);
|
||||
if (ref_base_lex_env_p.is_null ())
|
||||
{
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
@@ -1422,7 +1438,7 @@ opfunc_delete_var (ecma_completion_value_t &ret_value, /**< out: completion valu
|
||||
|
||||
ecma_reference_t ref;
|
||||
ecma_op_get_identifier_reference (ref,
|
||||
int_data->lex_env_p,
|
||||
*int_data->lex_env_p,
|
||||
name_string_p,
|
||||
int_data->is_strict);
|
||||
|
||||
@@ -1439,7 +1455,8 @@ opfunc_delete_var (ecma_completion_value_t &ret_value, /**< out: completion valu
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *bindings_p = ecma_get_object_from_value (ref.base);
|
||||
ecma_object_ptr_t bindings_p;
|
||||
ecma_get_object_from_value (bindings_p, ref.base);
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (bindings_p));
|
||||
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_delete_binding, delete_completion, bindings_p,
|
||||
@@ -1500,7 +1517,8 @@ opfunc_delete_prop (ecma_completion_value_t &ret_value, /**< out: completion val
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_object, obj_value, base_value);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_object (obj_value));
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, obj_value);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));
|
||||
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_delete, delete_op_ret_val, obj_p, name_string_p, int_data->is_strict);
|
||||
|
||||
@@ -78,7 +78,7 @@ typedef struct
|
||||
{
|
||||
opcode_counter_t pos; /**< current opcode to execute */
|
||||
const ecma_value_t* this_binding_p; /**< this binding for current context */
|
||||
ecma_object_t *lex_env_p; /**< current lexical environment */
|
||||
const ecma_object_ptr_t *lex_env_p; /**< current lexical environment */
|
||||
bool is_strict; /**< is current code execution mode strict? */
|
||||
bool is_eval_code; /**< is current code executed with eval */
|
||||
idx_t min_reg_num; /**< minimum idx used for register identification */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE)
|
||||
|
||||
// 15.4.4.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_ARRAY),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -62,7 +62,8 @@ ecma_builtin_array_object_is_array (ecma_completion_value_t &ret_value, /**< out
|
||||
|
||||
if (ecma_is_value_object (arg))
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (arg);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, arg);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_ARRAY)
|
||||
|
||||
// 15.4.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -97,7 +97,8 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_completion_value_t &ret_val
|
||||
}
|
||||
else if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, this_arg);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -119,7 +120,9 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_completion_value_t &ret_val
|
||||
}
|
||||
}
|
||||
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
} /* ecma_builtin_boolean_prototype_object_value_of */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE)
|
||||
|
||||
// 15.6.4.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_BOOLEAN),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_BOOLEAN),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_BOOLEAN)
|
||||
|
||||
// 15.6.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -55,7 +55,9 @@ ecma_builtin_compact_profile_error_dispatch_call (ecma_completion_value_t &ret_v
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
ecma_object_ptr_t cp_error_obj_p;
|
||||
ecma_builtin_get (cp_error_obj_p, ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR);
|
||||
ecma_make_throw_obj_completion_value (ret_value, cp_error_obj_p);
|
||||
} /* ecma_builtin_compact_profile_error_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -70,7 +72,9 @@ ecma_builtin_compact_profile_error_dispatch_construct (ecma_completion_value_t &
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
ecma_object_ptr_t cp_error_obj_p;
|
||||
ecma_builtin_get (cp_error_obj_p, ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR);
|
||||
ecma_make_throw_obj_completion_value (ret_value, cp_error_obj_p);
|
||||
} /* ecma_builtin_compact_profile_error_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -60,11 +60,14 @@ ecma_builtin_error_prototype_object_to_string (ecma_completion_value_t &ret_valu
|
||||
// 2.
|
||||
if (!ecma_is_value_object (this_arg))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, this_arg);
|
||||
ecma_string_t *name_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_NAME);
|
||||
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_get, name_get_ret_value, obj_p, name_magic_string_p);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_ERROR_PROTOTYPE)
|
||||
|
||||
// 15.11.4.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -61,15 +61,16 @@ ecma_builtin_error_dispatch_call (ecma_completion_value_t &ret_value, /**< out:
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
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_COMMON,
|
||||
message_string_p);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error_with_message (new_error_object_p, ECMA_ERROR_COMMON, message_string_p);
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_COMMON);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error (new_error_object_p, ECMA_ERROR_COMMON);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
|
||||
// 15.7.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_ERROR_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE)
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_EVAL_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_EVAL_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -61,15 +61,16 @@ ecma_builtin_eval_error_dispatch_call (ecma_completion_value_t &ret_value, /**<
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
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_EVAL,
|
||||
message_string_p);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error_with_message (new_error_object_p, ECMA_ERROR_EVAL, message_string_p);
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_EVAL);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error (new_error_object_p, ECMA_ERROR_EVAL);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -139,7 +139,9 @@ ecma_builtin_function_prototype_dispatch_construct (ecma_completion_value_t &ret
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
} /* ecma_builtin_function_prototype_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE)
|
||||
|
||||
// 15.3.4.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_FUNCTION),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -41,7 +41,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_FUNCTION)
|
||||
|
||||
// 15.3.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,14 +76,14 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_INFINITY_UL,
|
||||
|
||||
// ECMA-262 v5, 15.1.4.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_OBJECT_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_OBJECT),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.2
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_FUNCTION_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_FUNCTION),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
@@ -91,7 +91,7 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_FUNCTION_UL,
|
||||
// ECMA-262 v5, 15.1.4.3
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_ARRAY_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_ARRAY),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
@@ -100,7 +100,7 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_ARRAY_UL,
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN
|
||||
// ECMA-262 v5, 15.1.4.4
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_STRING_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_STRING),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_STRING),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
@@ -109,7 +109,7 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_STRING_UL,
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN
|
||||
// ECMA-262 v5, 15.1.4.5
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_BOOLEAN_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_BOOLEAN),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_BOOLEAN),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
@@ -118,7 +118,7 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_BOOLEAN_UL,
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN
|
||||
// ECMA-262 v5, 15.1.4.6
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_NUMBER_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_NUMBER),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_NUMBER),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
@@ -126,14 +126,14 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_NUMBER_UL,
|
||||
|
||||
// ECMA-262 v5, 15.1.4.7
|
||||
CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_DATE_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_DATE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_DATE),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.8
|
||||
CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_REG_EXP_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_REGEXP),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
@@ -141,49 +141,49 @@ CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_REG_EXP_UL,
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS
|
||||
// ECMA-262 v5, 15.1.4.9
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.10
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_EVAL_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_EVAL_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_EVAL_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.11
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_RANGE_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_RANGE_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_RANGE_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.12
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_REFERENCE_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_REFERENCE_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_REFERENCE_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.13
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_SYNTAX_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_SYNTAX_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_SYNTAX_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.14
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_TYPE_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_TYPE_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
// ECMA-262 v5, 15.1.4.15
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_URI_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_URI_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_URI_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
@@ -192,7 +192,7 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_URI_ERROR_UL,
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_MATH_BUILTIN
|
||||
// ECMA-262 v5, 15.1.5.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_MATH_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_MATH),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_MATH),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
@@ -200,14 +200,14 @@ OBJECT_VALUE (ECMA_MAGIC_STRING_MATH_UL,
|
||||
|
||||
// ECMA-262 v5, 15.1.5.2
|
||||
CP_UNIMPLEMENTED_VALUE (ECMA_MAGIC_STRING_JSON_U,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_JSON),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_JSON),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
#ifdef CONFIG_ECMA_COMPACT_PROFILE
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_COMPACT_PROFILE_ERROR_UL,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -99,7 +99,7 @@ SORT_PROPERTY_NAMES_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (void)
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_object_t *obj_p, /**< object */
|
||||
TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (const ecma_object_ptr_t& obj_p, /**< object */
|
||||
ecma_string_t *prop_name_p) /**< property's name */
|
||||
{
|
||||
#define OBJECT_ID(builtin_id) const ecma_builtin_id_t builtin_object_id = builtin_id;
|
||||
@@ -170,9 +170,11 @@ TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_object_t
|
||||
{
|
||||
#define ROUTINE(name, c_function_name, args_number, length_prop_value) case name: \
|
||||
{ \
|
||||
ecma_object_t *func_obj_p = ecma_builtin_make_function_object_for_routine (builtin_object_id, \
|
||||
id, \
|
||||
length_prop_value); \
|
||||
ecma_object_ptr_t func_obj_p; \
|
||||
ecma_builtin_make_function_object_for_routine (func_obj_p, \
|
||||
builtin_object_id, \
|
||||
id, \
|
||||
length_prop_value); \
|
||||
\
|
||||
writable = ECMA_PROPERTY_WRITABLE; \
|
||||
enumerable = ECMA_PROPERTY_NOT_ENUMERABLE; \
|
||||
@@ -184,7 +186,9 @@ TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_object_t
|
||||
}
|
||||
#define OBJECT_VALUE(name, obj_getter, prop_writable, prop_enumerable, prop_configurable) case name: \
|
||||
{ \
|
||||
value = obj_getter; \
|
||||
ecma_object_ptr_t object_out_p; \
|
||||
obj_getter; \
|
||||
value = object_out_p; \
|
||||
writable = prop_writable; \
|
||||
enumerable = prop_enumerable; \
|
||||
configurable = prop_configurable; \
|
||||
@@ -229,7 +233,8 @@ TRY_TO_INSTANTIATE_PROPERTY_ROUTINE_NAME (BUILTIN_UNDERSCORED_ID) (ecma_object_t
|
||||
#define CP_UNIMPLEMENTED_VALUE(name, value, prop_writable, prop_enumerable, prop_configurable) case name: \
|
||||
{ \
|
||||
/* The object throws CompactProfileError upon invocation */ \
|
||||
ecma_object_t *get_set_p = ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR); \
|
||||
ecma_object_ptr_t get_set_p; \
|
||||
ecma_builtin_get (get_set_p, ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR); \
|
||||
ecma_property_t *compact_profile_thrower_property_p = ecma_create_named_accessor_property (obj_p, \
|
||||
prop_name_p, \
|
||||
get_set_p, \
|
||||
|
||||
@@ -69,7 +69,8 @@ ecma_builtin_number_prototype_object_to_string (ecma_completion_value_t &ret_val
|
||||
}
|
||||
else if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, this_arg);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -84,13 +85,17 @@ ecma_builtin_number_prototype_object_to_string (ecma_completion_value_t &ret_val
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -145,7 +150,8 @@ ecma_builtin_number_prototype_object_value_of (ecma_completion_value_t &ret_valu
|
||||
}
|
||||
else if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, this_arg);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -165,7 +171,9 @@ ecma_builtin_number_prototype_object_value_of (ecma_completion_value_t &ret_valu
|
||||
}
|
||||
}
|
||||
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
} /* ecma_builtin_number_prototype_object_value_of */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE)
|
||||
|
||||
// 15.7.4.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_NUMBER),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_NUMBER),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -82,7 +82,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_NEGATIVE_INFINITY_U,
|
||||
|
||||
// 15.7.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_NUMBER_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -80,8 +80,9 @@ ecma_builtin_object_prototype_object_to_string (ecma_completion_value_t &ret_val
|
||||
ecma_get_completion_value_value (obj_this_value, this_to_obj_completion);
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_object (obj_this_value));
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (ecma_get_object_from_value (obj_this_value),
|
||||
ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
ecma_object_ptr_t obj_this_p;
|
||||
ecma_get_object_from_value (obj_this_p, obj_this_value);
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_this_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
type_string = (ecma_magic_string_id_t) class_prop_p->u.internal_property.value;
|
||||
|
||||
ecma_free_completion_value (this_to_obj_completion);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE)
|
||||
|
||||
// 15.2.4.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_OBJECT),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -80,7 +80,8 @@ ecma_builtin_object_dispatch_construct (ecma_completion_value_t &ret_value, /**<
|
||||
|
||||
if (arguments_list_len == 0)
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_op_create_object_object_noarg (obj_p);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (obj_p));
|
||||
}
|
||||
@@ -329,11 +330,14 @@ ecma_builtin_object_object_define_property (ecma_completion_value_t &ret_value,
|
||||
{
|
||||
if (!ecma_is_value_object (arg1))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (arg1);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, arg1);
|
||||
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, name_str_value, arg2);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
|
||||
// 15.2.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE)
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_RANGE_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_RANGE_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -61,15 +61,16 @@ ecma_builtin_range_error_dispatch_call (ecma_completion_value_t &ret_value, /**<
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
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_RANGE,
|
||||
message_string_p);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error_with_message (new_error_object_p, ECMA_ERROR_RANGE, message_string_p);
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_RANGE);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error (new_error_object_p, ECMA_ERROR_RANGE);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE)
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_REFERENCE_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_REFERENCE_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -61,15 +61,16 @@ ecma_builtin_reference_error_dispatch_call (ecma_completion_value_t &ret_value,
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
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_REFERENCE,
|
||||
message_string_p);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error_with_message (new_error_object_p, ECMA_ERROR_REFERENCE, message_string_p);
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_REFERENCE);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error (new_error_object_p, ECMA_ERROR_REFERENCE);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -67,7 +67,8 @@ ecma_builtin_string_prototype_object_to_string (ecma_completion_value_t &ret_val
|
||||
}
|
||||
else if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, this_arg);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -86,7 +87,9 @@ ecma_builtin_string_prototype_object_to_string (ecma_completion_value_t &ret_val
|
||||
}
|
||||
}
|
||||
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
} /* ecma_builtin_string_prototype_object_to_string */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_STRING_PROTOTYPE)
|
||||
|
||||
// 15.5.4.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_STRING),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_STRING),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -77,7 +77,9 @@ ecma_builtin_string_object_from_char_code (ecma_completion_value_t &ret_value, /
|
||||
#if CONFIG_ECMA_CHAR_ENCODING == CONFIG_ECMA_CHAR_ASCII
|
||||
if ((uint16_char_code >> JERRY_BITSINBYTE) != 0)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
|
||||
// 15.7.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_STRING_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_STRING_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE)
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_SYNTAX_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_SYNTAX_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -61,15 +61,16 @@ ecma_builtin_syntax_error_dispatch_call (ecma_completion_value_t &ret_value, /**
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
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);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error_with_message (new_error_object_p, ECMA_ERROR_SYNTAX, message_string_p);
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_SYNTAX);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error (new_error_object_p, ECMA_ERROR_SYNTAX);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -57,7 +57,9 @@ ecma_builtin_type_error_thrower_dispatch_call (ecma_completion_value_t &ret_valu
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
/* The object should throw TypeError */
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
} /* ecma_builtin_type_error_thrower_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -76,7 +78,9 @@ ecma_builtin_type_error_thrower_dispatch_construct (ecma_completion_value_t &ret
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
/* The object is not a constructor */
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
} /* ecma_builtin_type_error_thrower_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE)
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_TYPE_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -61,15 +61,16 @@ ecma_builtin_type_error_dispatch_call (ecma_completion_value_t &ret_value, /**<
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
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_TYPE,
|
||||
message_string_p);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error_with_message (new_error_object_p, ECMA_ERROR_TYPE, message_string_p);
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_TYPE);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error (new_error_object_p, ECMA_ERROR_TYPE);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,7 +37,7 @@ OBJECT_ID (ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE)
|
||||
|
||||
// 15.11.7.8
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_CONSTRUCTOR,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_URI_ERROR),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_URI_ERROR),
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_CONFIGURABLE)
|
||||
|
||||
@@ -61,15 +61,16 @@ ecma_builtin_uri_error_dispatch_call (ecma_completion_value_t &ret_value, /**< o
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_string, msg_str_value, arguments_list_p[0]);
|
||||
|
||||
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_URI,
|
||||
message_string_p);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error_with_message (new_error_object_p, ECMA_ERROR_URI, message_string_p);
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
|
||||
ECMA_FINALIZE (msg_str_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *new_error_object_p = ecma_new_standard_error (ECMA_ERROR_URI);
|
||||
ecma_object_ptr_t new_error_object_p;
|
||||
ecma_new_standard_error (new_error_object_p, ECMA_ERROR_URI);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (new_error_object_p));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,7 +51,7 @@ NUMBER_VALUE (ECMA_MAGIC_STRING_LENGTH,
|
||||
|
||||
// 15.11.3.1
|
||||
OBJECT_VALUE (ECMA_MAGIC_STRING_PROTOTYPE,
|
||||
ecma_builtin_get (ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE),
|
||||
ecma_builtin_get (object_out_p, ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE),
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
|
||||
@@ -47,8 +47,9 @@
|
||||
#define ECMA_BUILTIN_ROUTINE_ID_BUILT_IN_ROUTINE_ID_WIDTH (16)
|
||||
|
||||
/* ecma-builtins.c */
|
||||
extern ecma_object_t*
|
||||
ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id,
|
||||
extern void
|
||||
ecma_builtin_make_function_object_for_routine (ecma_object_ptr_t &ret_val,
|
||||
ecma_builtin_id_t builtin_id,
|
||||
ecma_magic_string_id_t routine_id,
|
||||
ecma_number_t length_prop_num_value);
|
||||
extern int32_t
|
||||
@@ -77,7 +78,7 @@ ecma_builtin_ ## lowercase_name ## _dispatch_routine (ecma_completion_value_t &r
|
||||
const ecma_value_t arguments_list [], \
|
||||
ecma_length_t arguments_number); \
|
||||
extern ecma_property_t* \
|
||||
ecma_builtin_ ## lowercase_name ## _try_to_instantiate_property (ecma_object_t *obj_p, \
|
||||
ecma_builtin_ ## lowercase_name ## _try_to_instantiate_property (const ecma_object_ptr_t& obj_p, \
|
||||
ecma_string_t *prop_name_p); \
|
||||
extern void \
|
||||
ecma_builtin_ ## lowercase_name ## _sort_property_names (void);
|
||||
@@ -94,7 +95,8 @@ ecma_builtin_ ## lowercase_name ## _sort_property_names (void);
|
||||
{ \
|
||||
jerry_ref_unused_variables (0, __VA_ARGS__); \
|
||||
} \
|
||||
ecma_object_t *cp_error_p = ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR); \
|
||||
ecma_object_ptr_t cp_error_p; \
|
||||
ecma_builtin_get (cp_error_p, ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR); \
|
||||
ecma_make_throw_obj_completion_value (ret_value, cp_error_p); \
|
||||
return; \
|
||||
}
|
||||
|
||||
@@ -49,18 +49,21 @@ static ecma_object_t* ecma_builtin_objects [ECMA_BUILTIN_ID__COUNT];
|
||||
* Check if passed object is the instance of specified built-in.
|
||||
*/
|
||||
bool
|
||||
ecma_builtin_is (ecma_object_t *obj_p, /**< pointer to an object */
|
||||
ecma_builtin_is (const ecma_object_ptr_t& obj_p, /**< pointer to an object */
|
||||
ecma_builtin_id_t builtin_id) /**< id of built-in to check on */
|
||||
{
|
||||
JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT (obj_p.is_not_null () && !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT);
|
||||
|
||||
if (unlikely (ecma_builtin_objects [builtin_id] == NULL))
|
||||
ecma_object_ptr_t builtin_obj_p;
|
||||
builtin_obj_p = ecma_builtin_objects [builtin_id];
|
||||
|
||||
if (unlikely (builtin_obj_p.is_null ()))
|
||||
{
|
||||
ecma_instantiate_builtin (builtin_id);
|
||||
}
|
||||
|
||||
return (obj_p == ecma_builtin_objects [builtin_id]);
|
||||
return (obj_p == builtin_obj_p);
|
||||
} /* ecma_builtin_is */
|
||||
|
||||
/**
|
||||
@@ -68,19 +71,24 @@ ecma_builtin_is (ecma_object_t *obj_p, /**< pointer to an object */
|
||||
*
|
||||
* @return pointer to the object's instance
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_builtin_get (ecma_builtin_id_t builtin_id) /**< id of built-in to check on */
|
||||
void
|
||||
ecma_builtin_get (ecma_object_ptr_t &ret_val, /**< out: object pointer */
|
||||
ecma_builtin_id_t builtin_id) /**< id of built-in to check on */
|
||||
{
|
||||
JERRY_ASSERT (builtin_id < ECMA_BUILTIN_ID__COUNT);
|
||||
|
||||
if (unlikely (ecma_builtin_objects [builtin_id] == NULL))
|
||||
ecma_object_ptr_t builtin_obj_p;
|
||||
builtin_obj_p = ecma_builtin_objects [builtin_id];
|
||||
|
||||
if (unlikely (builtin_obj_p.is_null ()))
|
||||
{
|
||||
ecma_instantiate_builtin (builtin_id);
|
||||
builtin_obj_p = ecma_builtin_objects [builtin_id];
|
||||
}
|
||||
|
||||
ecma_ref_object (ecma_builtin_objects [builtin_id]);
|
||||
ecma_ref_object (builtin_obj_p);
|
||||
|
||||
return ecma_builtin_objects [builtin_id];
|
||||
ret_val = builtin_obj_p;
|
||||
} /* ecma_builtin_get */
|
||||
|
||||
/**
|
||||
@@ -91,14 +99,15 @@ ecma_builtin_get (ecma_builtin_id_t builtin_id) /**< id of built-in to check on
|
||||
*
|
||||
* @return pointer to the object
|
||||
*/
|
||||
static ecma_object_t*
|
||||
ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */
|
||||
ecma_object_t* prototype_obj_p, /**< prototype object */
|
||||
static void
|
||||
ecma_builtin_init_object (ecma_object_ptr_t &object_obj_p, /**< out: object pointer */
|
||||
ecma_builtin_id_t obj_builtin_id, /**< built-in ID */
|
||||
const ecma_object_ptr_t& prototype_obj_p, /**< prototype object */
|
||||
ecma_object_type_t obj_type, /**< object's type */
|
||||
ecma_magic_string_id_t obj_class, /**< object's class */
|
||||
bool is_extensible) /**< value of object's [[Extensible]] property */
|
||||
{
|
||||
ecma_object_t *object_obj_p = ecma_create_object (prototype_obj_p, is_extensible, obj_type);
|
||||
ecma_create_object (object_obj_p, prototype_obj_p, is_extensible, obj_type);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (object_obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
@@ -156,8 +165,6 @@ ecma_builtin_init_object (ecma_builtin_id_t obj_builtin_id, /**< built-in ID */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return object_obj_p;
|
||||
} /* ecma_builtin_init_object */
|
||||
|
||||
/**
|
||||
@@ -193,27 +200,26 @@ ecma_instantiate_builtin (ecma_builtin_id_t id) /**< built-in id */
|
||||
JERRY_ASSERT (ecma_builtin_objects [builtin_id] == NULL); \
|
||||
ecma_builtin_ ## lowercase_name ## _sort_property_names (); \
|
||||
\
|
||||
ecma_object_t *prototype_obj_p; \
|
||||
if (object_prototype_builtin_id == ECMA_BUILTIN_ID__COUNT) \
|
||||
ecma_object_ptr_t prototype_obj_p; \
|
||||
if (object_prototype_builtin_id != ECMA_BUILTIN_ID__COUNT) \
|
||||
{ \
|
||||
prototype_obj_p = NULL; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
if (ecma_builtin_objects [object_prototype_builtin_id] == NULL) \
|
||||
prototype_obj_p = ecma_builtin_objects [object_prototype_builtin_id]; \
|
||||
if (prototype_obj_p.is_null ()) \
|
||||
{ \
|
||||
ecma_instantiate_builtin (object_prototype_builtin_id); \
|
||||
} \
|
||||
prototype_obj_p = ecma_builtin_objects [object_prototype_builtin_id]; \
|
||||
JERRY_ASSERT (prototype_obj_p != NULL); \
|
||||
JERRY_ASSERT (prototype_obj_p.is_not_null ()); \
|
||||
} \
|
||||
\
|
||||
ecma_object_t *builtin_obj_p = ecma_builtin_init_object (builtin_id, \
|
||||
prototype_obj_p, \
|
||||
object_type, \
|
||||
object_class, \
|
||||
is_extensible); \
|
||||
ecma_builtin_objects [builtin_id] = builtin_obj_p; \
|
||||
ecma_object_ptr_t builtin_obj_p; \
|
||||
ecma_builtin_init_object (builtin_obj_p, \
|
||||
builtin_id, \
|
||||
prototype_obj_p, \
|
||||
object_type, \
|
||||
object_class, \
|
||||
is_extensible); \
|
||||
ecma_builtin_objects [builtin_id] = (ecma_object_t*) builtin_obj_p; \
|
||||
\
|
||||
break; \
|
||||
}
|
||||
@@ -238,10 +244,11 @@ ecma_finalize_builtins (void)
|
||||
id < ECMA_BUILTIN_ID__COUNT;
|
||||
id = (ecma_builtin_id_t) (id + 1))
|
||||
{
|
||||
if (ecma_builtin_objects [id] != NULL)
|
||||
ecma_object_ptr_t builtin_obj_p;
|
||||
builtin_obj_p = ecma_builtin_objects [id];
|
||||
if (builtin_obj_p.is_not_null ())
|
||||
{
|
||||
ecma_deref_object (ecma_builtin_objects [id]);
|
||||
|
||||
ecma_deref_object (builtin_obj_p);
|
||||
ecma_builtin_objects [id] = NULL;
|
||||
}
|
||||
}
|
||||
@@ -256,7 +263,7 @@ ecma_finalize_builtins (void)
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object */
|
||||
ecma_builtin_try_to_instantiate_property (const ecma_object_ptr_t& object_p, /**< object */
|
||||
ecma_string_t *string_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_object_is_builtin (object_p));
|
||||
@@ -307,8 +314,9 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
|
||||
*
|
||||
* @return pointer to constructed Function object
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**< identifier of built-in object
|
||||
void
|
||||
ecma_builtin_make_function_object_for_routine (ecma_object_ptr_t &func_obj_p, /**< out: object pointer */
|
||||
ecma_builtin_id_t builtin_id, /**< identifier of built-in object
|
||||
that initially contains property
|
||||
with the routine */
|
||||
ecma_magic_string_id_t routine_id, /**< name of the built-in
|
||||
@@ -317,9 +325,10 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
|
||||
of 'length' property
|
||||
of function object to create */
|
||||
{
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
|
||||
|
||||
ecma_object_t *func_obj_p = ecma_create_object (prototype_obj_p, true, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
|
||||
ecma_create_object (func_obj_p, prototype_obj_p, true, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
|
||||
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
@@ -350,8 +359,6 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
|
||||
*len_p = length_prop_num_value;
|
||||
|
||||
ecma_set_named_data_property_value (len_prop_p, ecma_value_t (len_p));
|
||||
|
||||
return func_obj_p;
|
||||
} /* ecma_builtin_make_function_object_for_routine */
|
||||
|
||||
/**
|
||||
@@ -361,7 +368,7 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
|
||||
*/
|
||||
void
|
||||
ecma_builtin_dispatch_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< built-in object */
|
||||
const ecma_object_ptr_t& obj_p, /**< built-in object */
|
||||
const ecma_value_t& this_arg_value, /**< 'this' argument value */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< length of the arguments list */
|
||||
@@ -456,7 +463,7 @@ ecma_builtin_dispatch_call (ecma_completion_value_t &ret_value, /**< out: comple
|
||||
*/
|
||||
void
|
||||
ecma_builtin_dispatch_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< built-in object */
|
||||
const ecma_object_ptr_t& obj_p, /**< built-in object */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< length of the arguments list */
|
||||
{
|
||||
|
||||
@@ -41,21 +41,22 @@ extern void ecma_finalize_builtins (void);
|
||||
|
||||
extern void
|
||||
ecma_builtin_dispatch_call (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
const ecma_value_t& this_arg,
|
||||
const ecma_value_t *arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
extern void
|
||||
ecma_builtin_dispatch_construct (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
const ecma_value_t *arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
extern ecma_property_t*
|
||||
ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p,
|
||||
ecma_builtin_try_to_instantiate_property (const ecma_object_ptr_t& object_p,
|
||||
ecma_string_t *string_p);
|
||||
extern bool
|
||||
ecma_builtin_is (ecma_object_t *obj_p,
|
||||
ecma_builtin_is (const ecma_object_ptr_t& obj_p,
|
||||
ecma_builtin_id_t builtin_id);
|
||||
extern ecma_object_t*
|
||||
ecma_builtin_get (ecma_builtin_id_t builtin_id);
|
||||
extern void
|
||||
ecma_builtin_get (ecma_object_ptr_t &ret_val,
|
||||
ecma_builtin_id_t builtin_id);
|
||||
#endif /* !ECMA_BUILTINS_H */
|
||||
|
||||
@@ -73,14 +73,41 @@ JERRY_STATIC_ASSERT (sizeof (ecma_label_descriptor_t) == sizeof (uint64_t));
|
||||
mem_pools_free ((uint8_t*) p ## ecma_type); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Template of an allocation routine.
|
||||
*/
|
||||
#define ALLOC_MANAGED_PTR(ecma_type) void \
|
||||
ecma_alloc_ ## ecma_type (ecma_ ## ecma_type ## _ptr_t &ret_ ## ecma_type ## _p) \
|
||||
{ \
|
||||
ret_ ## ecma_type ## _p = (ecma_ ## ecma_type ## _t *) mem_pools_alloc (); \
|
||||
\
|
||||
JERRY_ASSERT (ret_ ## ecma_type ## _p.is_not_null ()); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Deallocation routine template
|
||||
*/
|
||||
#define DEALLOC_MANAGED_PTR(ecma_type) void \
|
||||
ecma_dealloc_ ## ecma_type (ecma_ ## ecma_type ## _ptr_t& ecma_type ## _p) \
|
||||
{ \
|
||||
ecma_ ## ecma_type ## _t* ecma_type ## _tmp_p = (ecma_ ## ecma_type ## _t*) ecma_type ## _p; \
|
||||
ecma_type ## _p = (ecma_ ## ecma_type ## _t *) NULL; \
|
||||
\
|
||||
mem_pools_free ((uint8_t*) ecma_type ## _tmp_p); \
|
||||
}
|
||||
|
||||
/**
|
||||
* Declaration of alloc/free routine for specified ecma-type.
|
||||
*/
|
||||
#define DECLARE_ROUTINES_FOR(ecma_type) \
|
||||
ALLOC(ecma_type) \
|
||||
DEALLOC(ecma_type)
|
||||
#define DECLARE_MANAGED_PTR_ROUTINES_FOR(ecma_type) \
|
||||
ALLOC_MANAGED_PTR(ecma_type) \
|
||||
DEALLOC_MANAGED_PTR(ecma_type)
|
||||
|
||||
DECLARE_MANAGED_PTR_ROUTINES_FOR (object)
|
||||
|
||||
DECLARE_ROUTINES_FOR (object)
|
||||
DECLARE_ROUTINES_FOR (property)
|
||||
DECLARE_ROUTINES_FOR (number)
|
||||
DECLARE_ROUTINES_FOR (collection_header)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,12 +30,12 @@
|
||||
*
|
||||
* @return pointer to allocated memory
|
||||
*/
|
||||
extern ecma_object_t *ecma_alloc_object (void);
|
||||
extern void ecma_alloc_object (ecma_object_ptr_t &ret_obj_p);
|
||||
|
||||
/**
|
||||
* Dealloc memory from an ecma-object
|
||||
*/
|
||||
extern void ecma_dealloc_object (ecma_object_t *object_p);
|
||||
extern void ecma_dealloc_object (ecma_object_ptr_t &object_p);
|
||||
|
||||
/**
|
||||
* Allocate memory for ecma-property
|
||||
|
||||
+136
-113
@@ -37,20 +37,20 @@
|
||||
/**
|
||||
* Global lists of objects sorted by generation identifier.
|
||||
*/
|
||||
static ecma_object_t *ecma_gc_objects_lists[ ECMA_GC_GEN_COUNT ];
|
||||
static ecma_object_t* ecma_gc_objects_lists[ ECMA_GC_GEN_COUNT ];
|
||||
|
||||
static void ecma_gc_mark (ecma_object_t *object_p, ecma_gc_gen_t maximum_gen_to_traverse);
|
||||
static void ecma_gc_sweep (ecma_object_t *object_p);
|
||||
static void ecma_gc_mark (const ecma_object_ptr_t &object_p, ecma_gc_gen_t maximum_gen_to_traverse);
|
||||
static void ecma_gc_sweep (ecma_object_ptr_t &object_p);
|
||||
|
||||
/**
|
||||
* Get GC reference counter of the object.
|
||||
*/
|
||||
static uint32_t
|
||||
ecma_gc_get_object_refs (ecma_object_t *object_p) /**< object */
|
||||
ecma_gc_get_object_refs (const ecma_object_ptr_t &object_p) /**< object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
|
||||
return (uint32_t) jrt_extract_bit_field (object_p->container,
|
||||
return (uint32_t) jrt_extract_bit_field (((ecma_object_t*) object_p)->container,
|
||||
ECMA_OBJECT_GC_REFS_POS,
|
||||
ECMA_OBJECT_GC_REFS_WIDTH);
|
||||
} /* ecma_gc_get_object_refs */
|
||||
@@ -59,26 +59,26 @@ ecma_gc_get_object_refs (ecma_object_t *object_p) /**< object */
|
||||
* Set GC reference counter of the object.
|
||||
*/
|
||||
static void
|
||||
ecma_gc_set_object_refs (ecma_object_t *object_p, /**< object */
|
||||
ecma_gc_set_object_refs (const ecma_object_ptr_t &object_p, /**< object */
|
||||
uint32_t refs) /**< new reference counter */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
refs,
|
||||
ECMA_OBJECT_GC_REFS_POS,
|
||||
ECMA_OBJECT_GC_REFS_WIDTH);
|
||||
((ecma_object_t*) object_p)->container = jrt_set_bit_field_value (((ecma_object_t*) object_p)->container,
|
||||
refs,
|
||||
ECMA_OBJECT_GC_REFS_POS,
|
||||
ECMA_OBJECT_GC_REFS_WIDTH);
|
||||
} /* ecma_gc_set_object_refs */
|
||||
|
||||
/**
|
||||
* Get GC generation of the object.
|
||||
*/
|
||||
static ecma_gc_gen_t
|
||||
ecma_gc_get_object_generation (ecma_object_t *object_p) /**< object */
|
||||
ecma_gc_get_object_generation (const ecma_object_ptr_t &object_p) /**< object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
|
||||
ecma_gc_gen_t ret = (ecma_gc_gen_t) jrt_extract_bit_field (object_p->container,
|
||||
ecma_gc_gen_t ret = (ecma_gc_gen_t) jrt_extract_bit_field (((ecma_object_t*) object_p)->container,
|
||||
ECMA_OBJECT_GC_GENERATION_POS,
|
||||
ECMA_OBJECT_GC_GENERATION_WIDTH);
|
||||
|
||||
@@ -91,48 +91,50 @@ ecma_gc_get_object_generation (ecma_object_t *object_p) /**< object */
|
||||
* Set GC generation of the object.
|
||||
*/
|
||||
static void
|
||||
ecma_gc_set_object_generation (ecma_object_t *object_p, /**< object */
|
||||
ecma_gc_set_object_generation (const ecma_object_ptr_t &object_p, /**< object */
|
||||
ecma_gc_gen_t generation) /**< generation */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
JERRY_ASSERT (generation < ECMA_GC_GEN_COUNT);
|
||||
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
generation,
|
||||
ECMA_OBJECT_GC_GENERATION_POS,
|
||||
ECMA_OBJECT_GC_GENERATION_WIDTH);
|
||||
((ecma_object_t*) object_p)->container = jrt_set_bit_field_value (((ecma_object_t*) object_p)->container,
|
||||
generation,
|
||||
ECMA_OBJECT_GC_GENERATION_POS,
|
||||
ECMA_OBJECT_GC_GENERATION_WIDTH);
|
||||
} /* ecma_gc_set_object_generation */
|
||||
|
||||
/**
|
||||
* Get next object in list of objects with same generation.
|
||||
*/
|
||||
static ecma_object_t*
|
||||
ecma_gc_get_object_next (ecma_object_t *object_p) /**< object */
|
||||
static void
|
||||
ecma_gc_get_object_next (ecma_object_ptr_t & ret_val, /**< out: object pointer */
|
||||
const ecma_object_ptr_t &object_p) /**< object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
|
||||
JERRY_ASSERT (sizeof (uintptr_t) * JERRY_BITSINBYTE >= ECMA_OBJECT_GC_NEXT_CP_WIDTH);
|
||||
uintptr_t next_cp = (uintptr_t) jrt_extract_bit_field (object_p->container,
|
||||
uintptr_t next_cp = (uintptr_t) jrt_extract_bit_field (((ecma_object_t*) object_p)->container,
|
||||
ECMA_OBJECT_GC_NEXT_CP_POS,
|
||||
ECMA_OBJECT_GC_NEXT_CP_WIDTH);
|
||||
|
||||
return ECMA_GET_POINTER (ecma_object_t,
|
||||
next_cp);
|
||||
ret_val.unpack_from (next_cp, true);
|
||||
} /* ecma_gc_get_object_next */
|
||||
|
||||
/**
|
||||
* Set next object in list of objects with same generation.
|
||||
*/
|
||||
static void
|
||||
ecma_gc_set_object_next (ecma_object_t *object_p, /**< object */
|
||||
ecma_object_t *next_object_p) /**< next object */
|
||||
ecma_gc_set_object_next (const ecma_object_ptr_t &object_mp, /**< object */
|
||||
const ecma_object_ptr_t &next_object_p) /**< next object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
|
||||
uintptr_t next_cp;
|
||||
ECMA_SET_POINTER (next_cp, next_object_p);
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
|
||||
JERRY_ASSERT (sizeof (uintptr_t) * JERRY_BITSINBYTE >= ECMA_OBJECT_GC_NEXT_CP_WIDTH);
|
||||
|
||||
uintptr_t next_cp;
|
||||
next_object_p.pack_to (next_cp, true);
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
next_cp,
|
||||
ECMA_OBJECT_GC_NEXT_CP_POS,
|
||||
@@ -143,11 +145,11 @@ ecma_gc_set_object_next (ecma_object_t *object_p, /**< object */
|
||||
* Get visited flag of the object.
|
||||
*/
|
||||
static bool
|
||||
ecma_gc_is_object_visited (ecma_object_t *object_p) /**< object */
|
||||
ecma_gc_is_object_visited (const ecma_object_ptr_t &object_p) /**< object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
|
||||
return jrt_extract_bit_field (object_p->container,
|
||||
return jrt_extract_bit_field (((ecma_object_t*) object_p)->container,
|
||||
ECMA_OBJECT_GC_VISITED_POS,
|
||||
ECMA_OBJECT_GC_VISITED_WIDTH);
|
||||
} /* ecma_gc_is_object_visited */
|
||||
@@ -156,11 +158,12 @@ ecma_gc_is_object_visited (ecma_object_t *object_p) /**< object */
|
||||
* Set visited flag of the object.
|
||||
*/
|
||||
static void
|
||||
ecma_gc_set_object_visited (ecma_object_t *object_p, /**< object */
|
||||
ecma_gc_set_object_visited (const ecma_object_ptr_t &object_mp, /**< object */
|
||||
bool is_visited) /**< flag value */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
is_visited,
|
||||
ECMA_OBJECT_GC_VISITED_POS,
|
||||
@@ -171,11 +174,11 @@ ecma_gc_set_object_visited (ecma_object_t *object_p, /**< object */
|
||||
* Get may_ref_younger_objects flag of the object.
|
||||
*/
|
||||
static bool
|
||||
ecma_gc_is_object_may_ref_younger_objects (ecma_object_t *object_p) /**< object */
|
||||
ecma_gc_is_object_may_ref_younger_objects (const ecma_object_ptr_t &object_p) /**< object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
|
||||
return jrt_extract_bit_field (object_p->container,
|
||||
return jrt_extract_bit_field (((ecma_object_t*) object_p)->container,
|
||||
ECMA_OBJECT_GC_MAY_REF_YOUNGER_OBJECTS_POS,
|
||||
ECMA_OBJECT_GC_MAY_REF_YOUNGER_OBJECTS_WIDTH);
|
||||
} /* ecma_gc_is_object_may_ref_younger_objects */
|
||||
@@ -184,11 +187,12 @@ ecma_gc_is_object_may_ref_younger_objects (ecma_object_t *object_p) /**< object
|
||||
* Set may_ref_younger_objects flag of the object.
|
||||
*/
|
||||
static void
|
||||
ecma_gc_set_object_may_ref_younger_objects (ecma_object_t *object_p, /**< object */
|
||||
ecma_gc_set_object_may_ref_younger_objects (const ecma_object_ptr_t &object_mp, /**< object */
|
||||
bool is_may_ref_younger_objects) /**< flag value */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
is_may_ref_younger_objects,
|
||||
ECMA_OBJECT_GC_MAY_REF_YOUNGER_OBJECTS_POS,
|
||||
@@ -199,37 +203,41 @@ ecma_gc_set_object_may_ref_younger_objects (ecma_object_t *object_p, /**< object
|
||||
* Initialize GC information for the object
|
||||
*/
|
||||
void
|
||||
ecma_init_gc_info (ecma_object_t *object_p) /**< object */
|
||||
ecma_init_gc_info (const ecma_object_ptr_t& object_mp) /**< object */
|
||||
{
|
||||
ecma_gc_set_object_refs (object_p, 1);
|
||||
ecma_gc_set_object_refs (object_mp, 1);
|
||||
|
||||
ecma_gc_set_object_generation (object_p, ECMA_GC_GEN_0);
|
||||
ecma_gc_set_object_next (object_p, ecma_gc_objects_lists[ ECMA_GC_GEN_0 ]);
|
||||
ecma_gc_objects_lists[ ECMA_GC_GEN_0 ] = object_p;
|
||||
ecma_object_ptr_t next_object_mp;
|
||||
next_object_mp = ecma_gc_objects_lists[ ECMA_GC_GEN_0 ];
|
||||
|
||||
ecma_gc_set_object_generation (object_mp, ECMA_GC_GEN_0);
|
||||
ecma_gc_set_object_next (object_mp, next_object_mp);
|
||||
ecma_gc_objects_lists[ ECMA_GC_GEN_0 ] = (ecma_object_t*) object_mp;
|
||||
|
||||
/* Should be set to false at the beginning of garbage collection */
|
||||
ecma_gc_set_object_visited (object_p, true);
|
||||
ecma_gc_set_object_visited (object_mp, true);
|
||||
|
||||
ecma_gc_set_object_may_ref_younger_objects (object_p, false);
|
||||
ecma_gc_set_object_may_ref_younger_objects (object_mp, false);
|
||||
} /* ecma_init_gc_info */
|
||||
|
||||
/**
|
||||
* Increase reference counter of an object
|
||||
*/
|
||||
void
|
||||
ecma_ref_object (ecma_object_t *object_p) /**< object */
|
||||
ecma_ref_object (const ecma_object_ptr_t& object_mp) /**< object */
|
||||
{
|
||||
ecma_gc_set_object_refs (object_p, ecma_gc_get_object_refs (object_p) + 1);
|
||||
ecma_gc_set_object_refs (object_mp, ecma_gc_get_object_refs (object_mp) + 1);
|
||||
} /* ecma_ref_object */
|
||||
|
||||
/**
|
||||
* Decrease reference counter of an object
|
||||
*/
|
||||
void
|
||||
ecma_deref_object (ecma_object_t *object_p) /**< object */
|
||||
ecma_deref_object (const ecma_object_ptr_t& object_mp) /**< object */
|
||||
{
|
||||
JERRY_ASSERT(ecma_gc_get_object_refs (object_p) > 0);
|
||||
ecma_gc_set_object_refs (object_p, ecma_gc_get_object_refs (object_p) - 1);
|
||||
JERRY_ASSERT(ecma_gc_get_object_refs (object_mp) > 0);
|
||||
|
||||
ecma_gc_set_object_refs (object_mp, ecma_gc_get_object_refs (object_mp) - 1);
|
||||
} /* ecma_deref_object */
|
||||
|
||||
/**
|
||||
@@ -238,7 +246,7 @@ ecma_deref_object (ecma_object_t *object_p) /**< object */
|
||||
* is less than generation of object specified by obj_p.
|
||||
*/
|
||||
void
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_value (ecma_object_t *obj_p, /**< object */
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_value (const ecma_object_ptr_t& obj_mp, /**< object */
|
||||
const ecma_value_t& value) /**< value */
|
||||
{
|
||||
if (!ecma_is_value_object (value))
|
||||
@@ -246,25 +254,26 @@ ecma_gc_update_may_ref_younger_object_flag_by_value (ecma_object_t *obj_p, /**<
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_object_t *ref_obj_p = ecma_get_object_from_value (value);
|
||||
JERRY_ASSERT(ref_obj_p != NULL);
|
||||
ecma_object_ptr_t ref_obj_p;
|
||||
ecma_get_object_from_value (ref_obj_p, value);
|
||||
JERRY_ASSERT(ref_obj_p.is_not_null ());
|
||||
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, ref_obj_p);
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (obj_mp, ref_obj_p);
|
||||
} /* ecma_gc_update_may_ref_younger_object_flag_by_value */
|
||||
|
||||
void
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (ecma_object_t *obj_p, /**< object */
|
||||
ecma_object_t *ref_obj_p) /**< referenced object
|
||||
or NULL */
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (const ecma_object_ptr_t& obj_mp, /**< object */
|
||||
const ecma_object_ptr_t& ref_obj_mp) /**< referenced object
|
||||
* or NULL */
|
||||
{
|
||||
if (ref_obj_p == NULL)
|
||||
if (ref_obj_mp.is_null ())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (ecma_gc_get_object_generation (ref_obj_p) < ecma_gc_get_object_generation (obj_p))
|
||||
if (ecma_gc_get_object_generation (ref_obj_mp) < ecma_gc_get_object_generation (obj_mp))
|
||||
{
|
||||
ecma_gc_set_object_may_ref_younger_objects (obj_p, true);
|
||||
ecma_gc_set_object_may_ref_younger_objects (obj_mp, true);
|
||||
}
|
||||
} /* ecma_gc_update_may_ref_younger_object_flag_by_object */
|
||||
|
||||
@@ -274,7 +283,10 @@ ecma_gc_update_may_ref_younger_object_flag_by_object (ecma_object_t *obj_p, /**<
|
||||
void
|
||||
ecma_gc_init (void)
|
||||
{
|
||||
__memset (ecma_gc_objects_lists, 0, sizeof (ecma_gc_objects_lists));
|
||||
for (uint32_t i = 0; i < ECMA_GC_GEN_COUNT; i++)
|
||||
{
|
||||
ecma_gc_objects_lists [i] = NULL;
|
||||
}
|
||||
} /* ecma_gc_init */
|
||||
|
||||
/**
|
||||
@@ -282,12 +294,12 @@ ecma_gc_init (void)
|
||||
* if referenced object's generation is less or equal to maximum_gen_to_traverse.
|
||||
*/
|
||||
void
|
||||
ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
||||
ecma_gc_mark (const ecma_object_ptr_t& object_p, /**< start object */
|
||||
ecma_gc_gen_t maximum_gen_to_traverse) /**< start recursive traverse
|
||||
if referenced object generation
|
||||
is less or equal to maximum_gen_to_traverse */
|
||||
{
|
||||
JERRY_ASSERT(object_p != NULL);
|
||||
JERRY_ASSERT(object_p.is_not_null ());
|
||||
|
||||
ecma_gc_set_object_visited (object_p, true);
|
||||
|
||||
@@ -296,8 +308,9 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
||||
|
||||
if (ecma_is_lexical_environment (object_p))
|
||||
{
|
||||
ecma_object_t *lex_env_p = ecma_get_lex_env_outer_reference (object_p);
|
||||
if (lex_env_p != NULL)
|
||||
ecma_object_ptr_t lex_env_p (ecma_pointer_t::is_linked_arg::not_linked);
|
||||
ecma_get_lex_env_outer_reference (lex_env_p, object_p);
|
||||
if (lex_env_p.is_not_null ())
|
||||
{
|
||||
if (ecma_gc_get_object_generation (lex_env_p) <= maximum_gen_to_traverse)
|
||||
{
|
||||
@@ -315,7 +328,8 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
||||
|
||||
if (ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND)
|
||||
{
|
||||
ecma_object_t *binding_object_p = ecma_get_lex_env_binding_object (object_p);
|
||||
ecma_object_ptr_t binding_object_p;
|
||||
ecma_get_lex_env_binding_object (binding_object_p, object_p);
|
||||
if (ecma_gc_get_object_generation (binding_object_p) <= maximum_gen_to_traverse)
|
||||
{
|
||||
if (!ecma_gc_is_object_visited (binding_object_p))
|
||||
@@ -334,8 +348,9 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *proto_p = ecma_get_object_prototype (object_p);
|
||||
if (proto_p != NULL)
|
||||
ecma_object_ptr_t proto_p (ecma_pointer_t::is_linked_arg::not_linked);
|
||||
ecma_get_object_prototype (proto_p, object_p);
|
||||
if (proto_p.is_not_null ())
|
||||
{
|
||||
if (ecma_gc_get_object_generation (proto_p) <= maximum_gen_to_traverse)
|
||||
{
|
||||
@@ -370,7 +385,8 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
||||
|
||||
if (ecma_is_value_object (value))
|
||||
{
|
||||
ecma_object_t *value_obj_p = ecma_get_object_from_value (value);
|
||||
ecma_object_ptr_t value_obj_p;
|
||||
ecma_get_object_from_value (value_obj_p, value);
|
||||
|
||||
if (ecma_gc_get_object_generation (value_obj_p) <= maximum_gen_to_traverse)
|
||||
{
|
||||
@@ -391,12 +407,11 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
||||
|
||||
case ECMA_PROPERTY_NAMEDACCESSOR:
|
||||
{
|
||||
ecma_object_t *getter_obj_p = ECMA_GET_POINTER (ecma_object_t,
|
||||
property_p->u.named_accessor_property.get_p);
|
||||
ecma_object_t *setter_obj_p = ECMA_GET_POINTER (ecma_object_t,
|
||||
property_p->u.named_accessor_property.set_p);
|
||||
ecma_object_ptr_t getter_obj_p, setter_obj_p;
|
||||
getter_obj_p.unpack_from (property_p->u.named_accessor_property.get_p, true);
|
||||
setter_obj_p.unpack_from (property_p->u.named_accessor_property.set_p, true);
|
||||
|
||||
if (getter_obj_p != NULL)
|
||||
if (getter_obj_p.is_not_null ())
|
||||
{
|
||||
if (ecma_gc_get_object_generation (getter_obj_p) <= maximum_gen_to_traverse)
|
||||
{
|
||||
@@ -412,7 +427,7 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
||||
}
|
||||
}
|
||||
|
||||
if (setter_obj_p != NULL)
|
||||
if (setter_obj_p.is_not_null ())
|
||||
{
|
||||
if (ecma_gc_get_object_generation (setter_obj_p) <= maximum_gen_to_traverse)
|
||||
{
|
||||
@@ -471,7 +486,8 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
||||
case ECMA_INTERNAL_PROPERTY_SCOPE: /* a lexical environment */
|
||||
case ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP: /* an object */
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER(ecma_object_t, property_value);
|
||||
ecma_object_ptr_t obj_p;
|
||||
obj_p.unpack_from (property_value);
|
||||
|
||||
if (ecma_gc_get_object_generation (obj_p) <= maximum_gen_to_traverse)
|
||||
{
|
||||
@@ -506,11 +522,11 @@ ecma_gc_mark (ecma_object_t *object_p, /**< start object */
|
||||
* Free specified object
|
||||
*/
|
||||
void
|
||||
ecma_gc_sweep (ecma_object_t *object_p) /**< object to free */
|
||||
ecma_gc_sweep (ecma_object_ptr_t &object_p) /**< object to free */
|
||||
{
|
||||
JERRY_ASSERT(object_p != NULL
|
||||
&& !ecma_gc_is_object_visited (object_p)
|
||||
&& ecma_gc_get_object_refs (object_p) == 0);
|
||||
JERRY_ASSERT (object_p.is_not_null ()
|
||||
&& !ecma_gc_is_object_visited (object_p)
|
||||
&& ecma_gc_get_object_refs (object_p) == 0);
|
||||
|
||||
if (!ecma_is_lexical_environment (object_p) ||
|
||||
ecma_get_lex_env_type (object_p) != ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND)
|
||||
@@ -540,9 +556,10 @@ ecma_gc_run (ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
|
||||
/* clearing visited flags for all objects of generations to be processed */
|
||||
for (ecma_gc_gen_t gen_id = ECMA_GC_GEN_0; gen_id <= max_gen_to_collect; gen_id = (ecma_gc_gen_t) (gen_id + 1))
|
||||
{
|
||||
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ gen_id ];
|
||||
obj_iter_p != NULL;
|
||||
obj_iter_p = ecma_gc_get_object_next (obj_iter_p))
|
||||
ecma_object_ptr_t obj_iter_p, obj_iter_next_p;
|
||||
for (obj_iter_p = ecma_gc_objects_lists[ gen_id ];
|
||||
obj_iter_p.is_not_null ();
|
||||
ecma_gc_get_object_next (obj_iter_next_p, obj_iter_p), obj_iter_p = obj_iter_next_p)
|
||||
{
|
||||
ecma_gc_set_object_visited (obj_iter_p, false);
|
||||
}
|
||||
@@ -552,9 +569,11 @@ ecma_gc_run (ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
|
||||
* start recursive marking traverse from the object */
|
||||
for (ecma_gc_gen_t gen_id = ECMA_GC_GEN_0; gen_id <= max_gen_to_collect; gen_id = (ecma_gc_gen_t) (gen_id + 1))
|
||||
{
|
||||
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ gen_id ];
|
||||
obj_iter_p != NULL;
|
||||
obj_iter_p = ecma_gc_get_object_next (obj_iter_p))
|
||||
ecma_object_ptr_t obj_iter_p, obj_iter_next_p;
|
||||
|
||||
for (obj_iter_p = ecma_gc_objects_lists[ gen_id ];
|
||||
obj_iter_p.is_not_null ();
|
||||
ecma_gc_get_object_next (obj_iter_next_p, obj_iter_p), obj_iter_p = obj_iter_next_p)
|
||||
{
|
||||
if (ecma_gc_get_object_refs (obj_iter_p) > 0
|
||||
&& !ecma_gc_is_object_visited (obj_iter_p))
|
||||
@@ -577,7 +596,8 @@ ecma_gc_run (ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
|
||||
|
||||
if (ecma_is_value_object (reg_value))
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (reg_value);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, reg_value);
|
||||
|
||||
if (!ecma_gc_is_object_visited (obj_p))
|
||||
{
|
||||
@@ -594,9 +614,11 @@ ecma_gc_run (ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
|
||||
gen_id < ECMA_GC_GEN_COUNT;
|
||||
gen_id = (ecma_gc_gen_t) (gen_id + 1))
|
||||
{
|
||||
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ gen_id ];
|
||||
obj_iter_p != NULL;
|
||||
obj_iter_p = ecma_gc_get_object_next (obj_iter_p))
|
||||
ecma_object_ptr_t obj_iter_p, obj_iter_next_p;
|
||||
|
||||
for (obj_iter_p = ecma_gc_objects_lists[ gen_id ];
|
||||
obj_iter_p.is_not_null ();
|
||||
ecma_gc_get_object_next (obj_iter_next_p, obj_iter_p), obj_iter_p = obj_iter_next_p)
|
||||
{
|
||||
if (ecma_gc_is_object_may_ref_younger_objects (obj_iter_p))
|
||||
{
|
||||
@@ -614,33 +636,31 @@ ecma_gc_run (ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
|
||||
}
|
||||
|
||||
JERRY_ASSERT (max_gen_to_collect <= ECMA_GC_GEN_COUNT);
|
||||
ecma_object_t *gen_last_obj_p[ ECMA_GC_GEN_COUNT ];
|
||||
#ifndef JERRY_NDEBUG
|
||||
__memset (gen_last_obj_p, 0, sizeof (gen_last_obj_p));
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
ecma_object_ptr_t gen_last_obj_p[ ECMA_GC_GEN_COUNT ];
|
||||
|
||||
for (ecma_gc_gen_t gen_id = ECMA_GC_GEN_0; gen_id <= max_gen_to_collect; gen_id = (ecma_gc_gen_t) (gen_id + 1))
|
||||
{
|
||||
ecma_object_t *obj_prev_p = NULL;
|
||||
ecma_object_ptr_t obj_prev_p;
|
||||
|
||||
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ gen_id ],
|
||||
*obj_next_p;
|
||||
obj_iter_p != NULL;
|
||||
obj_iter_p = obj_next_p)
|
||||
ecma_object_ptr_t obj_iter_p, obj_iter_next_p;
|
||||
|
||||
for (obj_iter_p = ecma_gc_objects_lists[ gen_id ];
|
||||
obj_iter_p.is_not_null ();
|
||||
obj_iter_p = obj_iter_next_p)
|
||||
{
|
||||
obj_next_p = ecma_gc_get_object_next (obj_iter_p);
|
||||
ecma_gc_get_object_next (obj_iter_next_p, obj_iter_p);
|
||||
|
||||
if (!ecma_gc_is_object_visited (obj_iter_p))
|
||||
{
|
||||
ecma_gc_sweep (obj_iter_p);
|
||||
|
||||
if (likely (obj_prev_p != NULL))
|
||||
if (likely (obj_prev_p.is_not_null ()))
|
||||
{
|
||||
ecma_gc_set_object_next (obj_prev_p, obj_next_p);
|
||||
ecma_gc_set_object_next (obj_prev_p, obj_iter_next_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_gc_objects_lists[ gen_id ] = obj_next_p;
|
||||
ecma_gc_objects_lists[ gen_id ] = (ecma_object_t*) obj_iter_next_p;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -666,9 +686,11 @@ ecma_gc_run (ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
|
||||
}
|
||||
|
||||
/* promoting to next generation */
|
||||
if (gen_last_obj_p[ gen_to_promote ] != NULL)
|
||||
if (gen_last_obj_p[ gen_to_promote ].is_not_null ())
|
||||
{
|
||||
ecma_gc_set_object_next (gen_last_obj_p [gen_to_promote], ecma_gc_objects_lists[ gen_to_promote + 1 ]);
|
||||
ecma_object_ptr_t next_object_mp;
|
||||
next_object_mp = ecma_gc_objects_lists[ gen_to_promote + 1 ];
|
||||
ecma_gc_set_object_next (gen_last_obj_p [gen_to_promote], next_object_mp);
|
||||
ecma_gc_objects_lists[ gen_to_promote + 1 ] = ecma_gc_objects_lists[ gen_to_promote ];
|
||||
ecma_gc_objects_lists[ gen_to_promote ] = NULL;
|
||||
}
|
||||
@@ -686,9 +708,10 @@ ecma_gc_run (ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co
|
||||
gen_id < ECMA_GC_GEN_COUNT;
|
||||
gen_id = (ecma_gc_gen_t) (gen_id + 1))
|
||||
{
|
||||
for (ecma_object_t *obj_iter_p = ecma_gc_objects_lists[ gen_id ];
|
||||
obj_iter_p != NULL;
|
||||
obj_iter_p = ecma_gc_get_object_next (obj_iter_p))
|
||||
ecma_object_ptr_t obj_iter_p, obj_iter_next_p;
|
||||
for (obj_iter_p = ecma_gc_objects_lists[ gen_id ];
|
||||
obj_iter_p.is_not_null ();
|
||||
ecma_gc_get_object_next (obj_iter_next_p, obj_iter_p), obj_iter_p = obj_iter_next_p)
|
||||
{
|
||||
JERRY_ASSERT(ecma_gc_get_object_generation (obj_iter_p) == gen_id);
|
||||
}
|
||||
|
||||
@@ -39,11 +39,15 @@ typedef enum
|
||||
} ecma_gc_gen_t;
|
||||
|
||||
extern void ecma_gc_init (void);
|
||||
extern void ecma_init_gc_info (ecma_object_t *object_p);
|
||||
extern void ecma_ref_object (ecma_object_t *object_p);
|
||||
extern void ecma_deref_object (ecma_object_t *object_p);
|
||||
extern void ecma_gc_update_may_ref_younger_object_flag_by_value (ecma_object_t *obj_p, const ecma_value_t& value);
|
||||
extern void ecma_gc_update_may_ref_younger_object_flag_by_object (ecma_object_t *obj_p, ecma_object_t *ref_obj_p);
|
||||
extern void ecma_init_gc_info (const ecma_object_ptr_t& object_p);
|
||||
extern void ecma_ref_object (const ecma_object_ptr_t& object_p);
|
||||
extern void ecma_deref_object (const ecma_object_ptr_t& object_p);
|
||||
extern void
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_value (const ecma_object_ptr_t& obj_p,
|
||||
const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (const ecma_object_ptr_t& obj_p,
|
||||
const ecma_object_ptr_t& ref_obj_p);
|
||||
extern void ecma_gc_run (ecma_gc_gen_t max_gen_to_collect);
|
||||
extern void ecma_try_to_give_back_some_memory (mem_try_give_memory_back_severity_t severity);
|
||||
|
||||
|
||||
@@ -758,14 +758,42 @@ typedef struct
|
||||
class ecma_pointer_t
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Argument specifying should the pointer
|
||||
* be linked into managed pointers list
|
||||
*/
|
||||
enum class is_linked_arg
|
||||
{
|
||||
linked, /**< perform link */
|
||||
not_linked /**< do not perform link */
|
||||
};
|
||||
|
||||
/* Constructors */
|
||||
__attribute_always_inline__
|
||||
ecma_pointer_t () : _ptr (NULL) {}
|
||||
ecma_pointer_t () : ecma_pointer_t (is_linked_arg::linked) { }
|
||||
|
||||
__attribute_always_inline__
|
||||
ecma_pointer_t (is_linked_arg is_linked) /**< should the pointer
|
||||
* be linked into managed
|
||||
* pointers list? */
|
||||
: _ptr (NULL)
|
||||
{
|
||||
if (is_linked == is_linked_arg::linked)
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
ecma_pointer_t (const ecma_pointer_t&) = delete;
|
||||
ecma_pointer_t (ecma_pointer_t&) = delete;
|
||||
ecma_pointer_t (ecma_pointer_t&&) = delete;
|
||||
|
||||
/* Destructor */
|
||||
~ecma_pointer_t ()
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
/* Getter */
|
||||
template<typename T>
|
||||
__attribute_always_inline__
|
||||
@@ -774,22 +802,6 @@ class ecma_pointer_t
|
||||
return static_cast<T*> (_ptr);
|
||||
}
|
||||
|
||||
/* Member access */
|
||||
template<typename T>
|
||||
__attribute_always_inline__
|
||||
T* operator -> () const
|
||||
{
|
||||
return (T*) _ptr;
|
||||
}
|
||||
|
||||
/* Dereference */
|
||||
template<typename T>
|
||||
__attribute_always_inline__
|
||||
T operator * () const
|
||||
{
|
||||
return *static_cast<T*> (_ptr);
|
||||
}
|
||||
|
||||
/* Assignment operators */
|
||||
template<typename T>
|
||||
__attribute_always_inline__
|
||||
@@ -819,40 +831,84 @@ class ecma_pointer_t
|
||||
return *this;
|
||||
}
|
||||
|
||||
ecma_pointer_t& operator = (ecma_pointer_t &) = delete;
|
||||
__attribute_always_inline__
|
||||
ecma_pointer_t& operator = (ecma_pointer_t& ptr) /**< managed pointer
|
||||
* to take value from */
|
||||
{
|
||||
const ecma_pointer_t &ptr_const = ptr;
|
||||
*this = ptr_const;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ecma_pointer_t& operator = (ecma_pointer_t &&) = delete;
|
||||
|
||||
/* Comparison */
|
||||
__attribute_always_inline__
|
||||
bool operator == (const ecma_pointer_t &ptr) const /**< raw pointer */
|
||||
{
|
||||
return (_ptr == ptr._ptr);
|
||||
}
|
||||
|
||||
__attribute_always_inline__
|
||||
bool is_null (void) const
|
||||
{
|
||||
return (_ptr == NULL);
|
||||
}
|
||||
|
||||
__attribute_always_inline__
|
||||
bool is_not_null (void) const
|
||||
{
|
||||
return (_ptr != NULL);
|
||||
}
|
||||
|
||||
/* Packing to compressed pointer */
|
||||
__attribute_always_inline__
|
||||
void pack_to (uintptr_t& compressed_pointer) const /**< reference to compressed pointer */
|
||||
void pack_to (uintptr_t& compressed_pointer, /**< reference to compressed pointer */
|
||||
bool may_be_null = false) const /**< flag indicating the pointer can be NULL */
|
||||
{
|
||||
ECMA_SET_NON_NULL_POINTER (compressed_pointer, _ptr);
|
||||
void *ptr = _ptr;
|
||||
|
||||
if (may_be_null)
|
||||
{
|
||||
ECMA_SET_POINTER (compressed_pointer, ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
ECMA_SET_NON_NULL_POINTER (compressed_pointer, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Unpacking from compressed pointer */
|
||||
__attribute_always_inline__
|
||||
void unpack_from (uintptr_t compressed_pointer) /**< compressed pointer */
|
||||
void unpack_from (uintptr_t compressed_pointer, /**< compressed pointer */
|
||||
bool may_be_null = false) /**< flag indicating the pointer can be NULL */
|
||||
{
|
||||
_ptr = ECMA_GET_NON_NULL_POINTER (void, compressed_pointer);
|
||||
if (may_be_null)
|
||||
{
|
||||
_ptr = ECMA_GET_POINTER (void, compressed_pointer);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ptr = ECMA_GET_NON_NULL_POINTER (void, compressed_pointer);
|
||||
}
|
||||
}
|
||||
|
||||
protected: /* accessible to ecma_pointer_t */
|
||||
void *_ptr; /* pointer storage */
|
||||
};
|
||||
|
||||
#define ECMA_DECLARE_POINTER_OPERATORS_FOR(type) \
|
||||
template ecma_pointer_t::operator type* () const; \
|
||||
template type* ecma_pointer_t::operator -> () const; \
|
||||
template type ecma_pointer_t::operator * () const; \
|
||||
template ecma_pointer_t& ecma_pointer_t::operator = (type *); \
|
||||
template ecma_pointer_t& ecma_pointer_t::operator = (const type &);
|
||||
#define ECMA_DECLARE_PTR_TYPE_AND_POINTER_OPERATORS_FOR(type_name) \
|
||||
typedef ecma_pointer_t ecma_ ## type_name ## _ptr_t; \
|
||||
template ecma_pointer_t::operator ecma_ ## type_name ## _t * () const; \
|
||||
template ecma_pointer_t& ecma_pointer_t::operator = (ecma_ ## type_name ## _t *); \
|
||||
template ecma_pointer_t& ecma_pointer_t::operator = (const ecma_ ## type_name ## _t &);
|
||||
|
||||
/**
|
||||
* ECMA managed pointers' operators explicit instantiation
|
||||
*/
|
||||
ECMA_DECLARE_POINTER_OPERATORS_FOR (ecma_number_t)
|
||||
ECMA_DECLARE_POINTER_OPERATORS_FOR (ecma_string_t)
|
||||
ECMA_DECLARE_POINTER_OPERATORS_FOR (ecma_object_t)
|
||||
ECMA_DECLARE_PTR_TYPE_AND_POINTER_OPERATORS_FOR (number)
|
||||
ECMA_DECLARE_PTR_TYPE_AND_POINTER_OPERATORS_FOR (string)
|
||||
ECMA_DECLARE_PTR_TYPE_AND_POINTER_OPERATORS_FOR (object)
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
+156
-113
@@ -36,14 +36,17 @@
|
||||
*
|
||||
* @return pointer to the object's descriptor
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_create_object (ecma_object_t *prototype_object_p, /**< pointer to prototybe of the object (or NULL) */
|
||||
void
|
||||
ecma_create_object (ecma_object_ptr_t &object_mp, /**< out: object pointer */
|
||||
const ecma_object_ptr_t& prototype_object_p, /**< pointer to prototybe of the object (or NULL) */
|
||||
bool is_extensible, /**< value of extensible attribute */
|
||||
ecma_object_type_t type) /**< object type */
|
||||
{
|
||||
ecma_object_t *object_p = ecma_alloc_object ();
|
||||
ecma_alloc_object (object_mp);
|
||||
|
||||
ecma_init_gc_info (object_p);
|
||||
ecma_init_gc_info (object_mp);
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
ECMA_NULL_POINTER,
|
||||
@@ -62,17 +65,15 @@ ecma_create_object (ecma_object_t *prototype_object_p, /**< pointer to prototybe
|
||||
ECMA_OBJECT_OBJ_TYPE_POS,
|
||||
ECMA_OBJECT_OBJ_TYPE_WIDTH);
|
||||
|
||||
uint64_t prototype_object_cp;
|
||||
ECMA_SET_POINTER (prototype_object_cp, prototype_object_p);
|
||||
uintptr_t prototype_object_cp;
|
||||
prototype_object_p.pack_to (prototype_object_cp, true);
|
||||
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
prototype_object_cp,
|
||||
ECMA_OBJECT_OBJ_PROTOTYPE_OBJECT_CP_POS,
|
||||
ECMA_OBJECT_OBJ_PROTOTYPE_OBJECT_CP_WIDTH);
|
||||
|
||||
ecma_set_object_is_builtin (object_p, false);
|
||||
|
||||
return object_p;
|
||||
ecma_set_object_is_builtin (object_mp, false);
|
||||
} /* ecma_create_object */
|
||||
|
||||
/**
|
||||
@@ -85,12 +86,15 @@ ecma_create_object (ecma_object_t *prototype_object_p, /**< pointer to prototybe
|
||||
*
|
||||
* @return pointer to the descriptor of lexical environment
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p) /**< outer lexical environment */
|
||||
void
|
||||
ecma_create_decl_lex_env (ecma_object_ptr_t &new_lexical_environment_mp, /**< out: lexical environment pointer */
|
||||
const ecma_object_ptr_t& outer_lexical_environment_p) /**< outer lexical environment */
|
||||
{
|
||||
ecma_object_t *new_lexical_environment_p = ecma_alloc_object ();
|
||||
ecma_alloc_object (new_lexical_environment_mp);
|
||||
|
||||
ecma_init_gc_info (new_lexical_environment_p);
|
||||
ecma_init_gc_info (new_lexical_environment_mp);
|
||||
|
||||
ecma_object_t *new_lexical_environment_p = (ecma_object_t*) new_lexical_environment_mp;
|
||||
|
||||
new_lexical_environment_p->container = jrt_set_bit_field_value (new_lexical_environment_p->container,
|
||||
ECMA_NULL_POINTER,
|
||||
@@ -106,14 +110,13 @@ ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p) /**< outer
|
||||
ECMA_OBJECT_LEX_ENV_TYPE_POS,
|
||||
ECMA_OBJECT_LEX_ENV_TYPE_WIDTH);
|
||||
|
||||
uint64_t outer_reference_cp;
|
||||
ECMA_SET_POINTER (outer_reference_cp, outer_lexical_environment_p);
|
||||
uintptr_t outer_reference_cp;
|
||||
outer_lexical_environment_p.pack_to (outer_reference_cp, true);
|
||||
|
||||
new_lexical_environment_p->container = jrt_set_bit_field_value (new_lexical_environment_p->container,
|
||||
outer_reference_cp,
|
||||
ECMA_OBJECT_LEX_ENV_OUTER_REFERENCE_CP_POS,
|
||||
ECMA_OBJECT_LEX_ENV_OUTER_REFERENCE_CP_WIDTH);
|
||||
|
||||
return new_lexical_environment_p;
|
||||
} /* ecma_create_decl_lex_env */
|
||||
|
||||
/**
|
||||
@@ -126,17 +129,20 @@ ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p) /**< outer
|
||||
*
|
||||
* @return pointer to the descriptor of lexical environment
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< outer lexical environment */
|
||||
ecma_object_t *binding_obj_p, /**< binding object */
|
||||
void
|
||||
ecma_create_object_lex_env (ecma_object_ptr_t &new_lexical_environment_mp, /**< out: lexical environment pointer */
|
||||
const ecma_object_ptr_t& outer_lexical_environment_p, /**< outer lexical environment */
|
||||
const ecma_object_ptr_t& binding_obj_p, /**< binding object */
|
||||
bool provide_this) /**< provideThis flag */
|
||||
{
|
||||
JERRY_ASSERT(binding_obj_p != NULL
|
||||
JERRY_ASSERT(binding_obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (binding_obj_p));
|
||||
|
||||
ecma_object_t *new_lexical_environment_p = ecma_alloc_object ();
|
||||
ecma_alloc_object (new_lexical_environment_mp);
|
||||
|
||||
ecma_init_gc_info (new_lexical_environment_p);
|
||||
ecma_init_gc_info (new_lexical_environment_mp);
|
||||
|
||||
ecma_object_t *new_lexical_environment_p = (ecma_object_t*) new_lexical_environment_mp;
|
||||
|
||||
new_lexical_environment_p->container = jrt_set_bit_field_value (new_lexical_environment_p->container,
|
||||
true,
|
||||
@@ -148,8 +154,8 @@ ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< out
|
||||
ECMA_OBJECT_LEX_ENV_TYPE_POS,
|
||||
ECMA_OBJECT_LEX_ENV_TYPE_WIDTH);
|
||||
|
||||
uint64_t outer_reference_cp;
|
||||
ECMA_SET_POINTER (outer_reference_cp, outer_lexical_environment_p);
|
||||
uintptr_t outer_reference_cp;
|
||||
outer_lexical_environment_p.pack_to (outer_reference_cp, true);
|
||||
new_lexical_environment_p->container = jrt_set_bit_field_value (new_lexical_environment_p->container,
|
||||
outer_reference_cp,
|
||||
ECMA_OBJECT_LEX_ENV_OUTER_REFERENCE_CP_POS,
|
||||
@@ -160,24 +166,24 @@ ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< out
|
||||
ECMA_OBJECT_LEX_ENV_PROVIDE_THIS_POS,
|
||||
ECMA_OBJECT_LEX_ENV_PROVIDE_THIS_WIDTH);
|
||||
|
||||
uint64_t bound_object_cp;
|
||||
ECMA_SET_NON_NULL_POINTER (bound_object_cp, binding_obj_p);
|
||||
uintptr_t bound_object_cp;
|
||||
binding_obj_p.pack_to (bound_object_cp);
|
||||
new_lexical_environment_p->container = jrt_set_bit_field_value (new_lexical_environment_p->container,
|
||||
bound_object_cp,
|
||||
ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_POS,
|
||||
ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_WIDTH);
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (new_lexical_environment_p, binding_obj_p);
|
||||
|
||||
return new_lexical_environment_p;
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (new_lexical_environment_mp, binding_obj_p);
|
||||
} /* ecma_create_object_lex_env */
|
||||
|
||||
/**
|
||||
* Check if the object is lexical environment.
|
||||
*/
|
||||
bool __attribute_pure__
|
||||
ecma_is_lexical_environment (const ecma_object_t *object_p) /**< object or lexical environment */
|
||||
ecma_is_lexical_environment (const ecma_object_ptr_t& object_mp) /**< object or lexical environment */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
return jrt_extract_bit_field (object_p->container,
|
||||
ECMA_OBJECT_IS_LEXICAL_ENVIRONMENT_POS,
|
||||
@@ -188,10 +194,12 @@ ecma_is_lexical_environment (const ecma_object_t *object_p) /**< object or lexic
|
||||
* Get value of [[Extensible]] object's internal property.
|
||||
*/
|
||||
bool __attribute_pure__
|
||||
ecma_get_object_extensible (const ecma_object_t *object_p) /**< object */
|
||||
ecma_get_object_extensible (const ecma_object_ptr_t& object_mp) /**< object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_mp));
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
return jrt_extract_bit_field (object_p->container,
|
||||
ECMA_OBJECT_OBJ_EXTENSIBLE_POS,
|
||||
@@ -202,11 +210,13 @@ ecma_get_object_extensible (const ecma_object_t *object_p) /**< object */
|
||||
* Set value of [[Extensible]] object's internal property.
|
||||
*/
|
||||
void
|
||||
ecma_set_object_extensible (ecma_object_t *object_p, /**< object */
|
||||
ecma_set_object_extensible (const ecma_object_ptr_t& object_mp, /**< object */
|
||||
bool is_extensible) /**< value of [[Extensible]] */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_mp));
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
is_extensible,
|
||||
@@ -218,10 +228,12 @@ ecma_set_object_extensible (ecma_object_t *object_p, /**< object */
|
||||
* Get object's internal implementation-defined type.
|
||||
*/
|
||||
ecma_object_type_t __attribute_pure__
|
||||
ecma_get_object_type (const ecma_object_t *object_p) /**< object */
|
||||
ecma_get_object_type (const ecma_object_ptr_t& object_mp) /**< object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_mp));
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
return (ecma_object_type_t) jrt_extract_bit_field (object_p->container,
|
||||
ECMA_OBJECT_OBJ_TYPE_POS,
|
||||
@@ -232,11 +244,13 @@ ecma_get_object_type (const ecma_object_t *object_p) /**< object */
|
||||
* Set object's internal implementation-defined type.
|
||||
*/
|
||||
void
|
||||
ecma_set_object_type (ecma_object_t *object_p, /**< object */
|
||||
ecma_set_object_type (const ecma_object_ptr_t& object_mp, /**< object */
|
||||
ecma_object_type_t type) /**< type */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_mp));
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
type,
|
||||
@@ -247,18 +261,20 @@ ecma_set_object_type (ecma_object_t *object_p, /**< object */
|
||||
/**
|
||||
* Get object's prototype.
|
||||
*/
|
||||
ecma_object_t* __attribute_pure__
|
||||
ecma_get_object_prototype (const ecma_object_t *object_p) /**< object */
|
||||
void
|
||||
ecma_get_object_prototype (ecma_object_ptr_t &ret_val, /**< out: object pointer */
|
||||
const ecma_object_ptr_t& object_mp) /**< object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_mp));
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
JERRY_ASSERT (sizeof (uintptr_t) * JERRY_BITSINBYTE >= ECMA_OBJECT_OBJ_PROTOTYPE_OBJECT_CP_WIDTH);
|
||||
uintptr_t prototype_object_cp = (uintptr_t) jrt_extract_bit_field (object_p->container,
|
||||
ECMA_OBJECT_OBJ_PROTOTYPE_OBJECT_CP_POS,
|
||||
ECMA_OBJECT_OBJ_PROTOTYPE_OBJECT_CP_WIDTH);
|
||||
return ECMA_GET_POINTER (ecma_object_t,
|
||||
prototype_object_cp);
|
||||
ret_val.unpack_from (prototype_object_cp, true);
|
||||
} /* ecma_get_object_prototype */
|
||||
|
||||
/**
|
||||
@@ -267,16 +283,18 @@ ecma_get_object_prototype (const ecma_object_t *object_p) /**< object */
|
||||
* @return true / false
|
||||
*/
|
||||
bool __attribute_pure__
|
||||
ecma_get_object_is_builtin (const ecma_object_t *object_p) /**< object */
|
||||
ecma_get_object_is_builtin (const ecma_object_ptr_t& object_mp) /**< object */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_mp));
|
||||
|
||||
const uint32_t offset = ECMA_OBJECT_OBJ_IS_BUILTIN_POS;
|
||||
const uint32_t width = ECMA_OBJECT_OBJ_IS_BUILTIN_WIDTH;
|
||||
|
||||
JERRY_ASSERT (sizeof (uintptr_t) * JERRY_BITSINBYTE >= width);
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
uintptr_t flag_value = (uintptr_t) jrt_extract_bit_field (object_p->container,
|
||||
offset,
|
||||
width);
|
||||
@@ -288,15 +306,17 @@ ecma_get_object_is_builtin (const ecma_object_t *object_p) /**< object */
|
||||
* Set flag indicating whether the object is a built-in object
|
||||
*/
|
||||
void
|
||||
ecma_set_object_is_builtin (ecma_object_t *object_p, /**< object */
|
||||
ecma_set_object_is_builtin (const ecma_object_ptr_t& object_mp, /**< object */
|
||||
bool is_builtin) /**< value of flag */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_mp));
|
||||
|
||||
const uint32_t offset = ECMA_OBJECT_OBJ_IS_BUILTIN_POS;
|
||||
const uint32_t width = ECMA_OBJECT_OBJ_IS_BUILTIN_WIDTH;
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
(uintptr_t) is_builtin,
|
||||
offset,
|
||||
@@ -307,10 +327,12 @@ ecma_set_object_is_builtin (ecma_object_t *object_p, /**< object */
|
||||
* Get type of lexical environment.
|
||||
*/
|
||||
ecma_lexical_environment_type_t __attribute_pure__
|
||||
ecma_get_lex_env_type (const ecma_object_t *object_p) /**< lexical environment */
|
||||
ecma_get_lex_env_type (const ecma_object_ptr_t& object_mp) /**< lexical environment */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (object_mp));
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
return (ecma_lexical_environment_type_t) jrt_extract_bit_field (object_p->container,
|
||||
ECMA_OBJECT_LEX_ENV_TYPE_POS,
|
||||
@@ -320,52 +342,57 @@ ecma_get_lex_env_type (const ecma_object_t *object_p) /**< lexical environment *
|
||||
/**
|
||||
* Get outer reference of lexical environment.
|
||||
*/
|
||||
ecma_object_t* __attribute_pure__
|
||||
ecma_get_lex_env_outer_reference (const ecma_object_t *object_p) /**< lexical environment */
|
||||
void
|
||||
ecma_get_lex_env_outer_reference (ecma_object_ptr_t &ret_val, /**< out: object pointer */
|
||||
const ecma_object_ptr_t& object_mp) /**< lexical environment */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (object_mp));
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
JERRY_ASSERT (sizeof (uintptr_t) * JERRY_BITSINBYTE >= ECMA_OBJECT_LEX_ENV_OUTER_REFERENCE_CP_WIDTH);
|
||||
uintptr_t outer_reference_cp = (uintptr_t) jrt_extract_bit_field (object_p->container,
|
||||
ECMA_OBJECT_LEX_ENV_OUTER_REFERENCE_CP_POS,
|
||||
ECMA_OBJECT_LEX_ENV_OUTER_REFERENCE_CP_WIDTH);
|
||||
return ECMA_GET_POINTER (ecma_object_t,
|
||||
outer_reference_cp);
|
||||
ret_val.unpack_from (outer_reference_cp, true);
|
||||
} /* ecma_get_lex_env_outer_reference */
|
||||
|
||||
/**
|
||||
* Get object's/lexical environment's property list.
|
||||
*/
|
||||
ecma_property_t* __attribute_pure__
|
||||
ecma_get_property_list (const ecma_object_t *object_p) /**< object or lexical environment */
|
||||
ecma_get_property_list (const ecma_object_ptr_t& object_mp) /**< object or lexical environment */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_p) ||
|
||||
ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_mp) ||
|
||||
ecma_get_lex_env_type (object_mp) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
JERRY_ASSERT (sizeof (uintptr_t) * JERRY_BITSINBYTE >= ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_WIDTH);
|
||||
uintptr_t properties_cp = (uintptr_t) jrt_extract_bit_field (object_p->container,
|
||||
ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_POS,
|
||||
ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_WIDTH);
|
||||
return ECMA_GET_POINTER (ecma_property_t,
|
||||
properties_cp);
|
||||
return ECMA_GET_POINTER (ecma_property_t, properties_cp);
|
||||
} /* ecma_get_property_list */
|
||||
|
||||
/**
|
||||
* Set object's/lexical environment's property list.
|
||||
*/
|
||||
static void
|
||||
ecma_set_property_list (ecma_object_t *object_p, /**< object or lexical environment */
|
||||
ecma_set_property_list (const ecma_object_ptr_t& object_mp, /**< object or lexical environment */
|
||||
ecma_property_t *property_list_p) /**< properties' list */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_p) ||
|
||||
ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (object_mp) ||
|
||||
ecma_get_lex_env_type (object_mp) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
|
||||
|
||||
uint64_t properties_cp;
|
||||
uintptr_t properties_cp;
|
||||
ECMA_SET_POINTER (properties_cp, property_list_p);
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
object_p->container = jrt_set_bit_field_value (object_p->container,
|
||||
properties_cp,
|
||||
ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_POS,
|
||||
@@ -376,13 +403,16 @@ ecma_set_property_list (ecma_object_t *object_p, /**< object or lexical environm
|
||||
* Get lexical environment's 'provideThis' property
|
||||
*/
|
||||
bool __attribute_pure__
|
||||
ecma_get_lex_env_provide_this (const ecma_object_t *object_p) /**< object-bound lexical environment */
|
||||
ecma_get_lex_env_provide_this (const ecma_object_ptr_t& object_mp) /**< object-bound lexical environment */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (object_p) &&
|
||||
ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (object_mp) &&
|
||||
ecma_get_lex_env_type (object_mp) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
|
||||
JERRY_ASSERT (sizeof (uintptr_t) * JERRY_BITSINBYTE >= ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_WIDTH);
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
bool provide_this = (jrt_extract_bit_field (object_p->container,
|
||||
ECMA_OBJECT_LEX_ENV_PROVIDE_THIS_POS,
|
||||
ECMA_OBJECT_LEX_ENV_PROVIDE_THIS_WIDTH) != 0);
|
||||
@@ -393,18 +423,21 @@ ecma_get_lex_env_provide_this (const ecma_object_t *object_p) /**< object-bound
|
||||
/**
|
||||
* Get lexical environment's bound object.
|
||||
*/
|
||||
ecma_object_t* __attribute_pure__
|
||||
ecma_get_lex_env_binding_object (const ecma_object_t *object_p) /**< object-bound lexical environment */
|
||||
void
|
||||
ecma_get_lex_env_binding_object (ecma_object_ptr_t &ret_val, /**< out: object pointer */
|
||||
const ecma_object_ptr_t& object_mp) /**< object-bound lexical environment */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (object_p) &&
|
||||
ecma_get_lex_env_type (object_p) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
JERRY_ASSERT (object_mp.is_not_null ());
|
||||
JERRY_ASSERT (ecma_is_lexical_environment (object_mp) &&
|
||||
ecma_get_lex_env_type (object_mp) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
|
||||
ecma_object_t *object_p = (ecma_object_t*) object_mp;
|
||||
|
||||
JERRY_ASSERT (sizeof (uintptr_t) * JERRY_BITSINBYTE >= ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_WIDTH);
|
||||
uintptr_t object_cp = (uintptr_t) jrt_extract_bit_field (object_p->container,
|
||||
ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_POS,
|
||||
ECMA_OBJECT_PROPERTIES_OR_BOUND_OBJECT_CP_WIDTH);
|
||||
return ECMA_GET_NON_NULL_POINTER (ecma_object_t, object_cp);
|
||||
ret_val.unpack_from (object_cp);
|
||||
} /* ecma_get_lex_env_binding_object */
|
||||
|
||||
/**
|
||||
@@ -414,7 +447,7 @@ ecma_get_lex_env_binding_object (const ecma_object_t *object_p) /**< object-boun
|
||||
* @return pointer to newly created property
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_create_internal_property (ecma_object_t *object_p, /**< the object */
|
||||
ecma_create_internal_property (const ecma_object_ptr_t& object_p, /**< the object */
|
||||
ecma_internal_property_id_t property_id) /**< internal property identifier */
|
||||
{
|
||||
JERRY_ASSERT (ecma_find_internal_property (object_p, property_id) == NULL);
|
||||
@@ -443,10 +476,10 @@ ecma_create_internal_property (ecma_object_t *object_p, /**< the object */
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_find_internal_property (ecma_object_t *object_p, /**< object descriptor */
|
||||
ecma_find_internal_property (const ecma_object_ptr_t& object_p, /**< object descriptor */
|
||||
ecma_internal_property_id_t property_id) /**< internal property identifier */
|
||||
{
|
||||
JERRY_ASSERT(object_p != NULL);
|
||||
JERRY_ASSERT(object_p.is_not_null ());
|
||||
|
||||
JERRY_ASSERT(property_id != ECMA_INTERNAL_PROPERTY_PROTOTYPE
|
||||
&& property_id != ECMA_INTERNAL_PROPERTY_EXTENSIBLE);
|
||||
@@ -476,7 +509,7 @@ ecma_find_internal_property (ecma_object_t *object_p, /**< object descriptor */
|
||||
* @return pointer to the property
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_get_internal_property (ecma_object_t *object_p, /**< object descriptor */
|
||||
ecma_get_internal_property (const ecma_object_ptr_t& object_p, /**< object descriptor */
|
||||
ecma_internal_property_id_t property_id) /**< internal property identifier */
|
||||
{
|
||||
ecma_property_t *property_p = ecma_find_internal_property (object_p, property_id);
|
||||
@@ -493,13 +526,13 @@ ecma_get_internal_property (ecma_object_t *object_p, /**< object descriptor */
|
||||
* @return pointer to newly created property
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_create_named_data_property (ecma_object_t *obj_p, /**< object */
|
||||
ecma_create_named_data_property (const ecma_object_ptr_t& obj_p, /**< object */
|
||||
ecma_string_t *name_p, /**< property name */
|
||||
bool is_writable, /**< 'Writable' attribute */
|
||||
bool is_enumerable, /**< 'Enumerable' attribute */
|
||||
bool is_configurable) /**< 'Configurable' attribute */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL && name_p != NULL);
|
||||
JERRY_ASSERT(obj_p.is_not_null () && name_p != NULL);
|
||||
JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL);
|
||||
|
||||
ecma_property_t *prop_p = ecma_alloc_property ();
|
||||
@@ -533,14 +566,14 @@ ecma_create_named_data_property (ecma_object_t *obj_p, /**< object */
|
||||
* @return pointer to newly created property
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */
|
||||
ecma_create_named_accessor_property (const ecma_object_ptr_t& obj_p, /**< object */
|
||||
ecma_string_t *name_p, /**< property name */
|
||||
ecma_object_t *get_p, /**< getter */
|
||||
ecma_object_t *set_p, /**< setter */
|
||||
const ecma_object_ptr_t& get_p, /**< getter */
|
||||
const ecma_object_ptr_t& set_p, /**< setter */
|
||||
bool is_enumerable, /**< 'enumerable' attribute */
|
||||
bool is_configurable) /**< 'configurable' attribute */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL && name_p != NULL);
|
||||
JERRY_ASSERT(obj_p.is_not_null () && name_p != NULL);
|
||||
JERRY_ASSERT(ecma_find_named_property (obj_p, name_p) == NULL);
|
||||
|
||||
ecma_property_t *prop_p = ecma_alloc_property ();
|
||||
@@ -550,10 +583,16 @@ ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */
|
||||
name_p = ecma_copy_or_ref_ecma_string (name_p);
|
||||
ECMA_SET_NON_NULL_POINTER(prop_p->u.named_accessor_property.name_p, name_p);
|
||||
|
||||
ECMA_SET_POINTER(prop_p->u.named_accessor_property.get_p, get_p);
|
||||
{
|
||||
ecma_object_t *get_tmp_p = (ecma_object_t*) get_p;
|
||||
ECMA_SET_POINTER (prop_p->u.named_accessor_property.get_p, get_tmp_p);
|
||||
}
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, get_p);
|
||||
|
||||
ECMA_SET_POINTER(prop_p->u.named_accessor_property.set_p, set_p);
|
||||
{
|
||||
ecma_object_t *set_tmp_p = (ecma_object_t*) set_p;
|
||||
ECMA_SET_POINTER (prop_p->u.named_accessor_property.set_p, set_tmp_p);
|
||||
}
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, set_p);
|
||||
|
||||
prop_p->u.named_accessor_property.enumerable = (is_enumerable ?
|
||||
@@ -579,10 +618,10 @@ ecma_create_named_accessor_property (ecma_object_t *obj_p, /**< object */
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in */
|
||||
ecma_find_named_property (const ecma_object_ptr_t& obj_p, /**< object to find property in */
|
||||
ecma_string_t *name_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL);
|
||||
JERRY_ASSERT(obj_p.is_not_null ());
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
|
||||
ecma_property_t *property_p;
|
||||
@@ -636,10 +675,10 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_get_named_property (ecma_object_t *obj_p, /**< object to find property in */
|
||||
ecma_get_named_property (const ecma_object_ptr_t& obj_p, /**< object to find property in */
|
||||
ecma_string_t *name_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL);
|
||||
JERRY_ASSERT(obj_p.is_not_null ());
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
|
||||
ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);
|
||||
@@ -659,10 +698,10 @@ ecma_get_named_property (ecma_object_t *obj_p, /**< object to find property in *
|
||||
* NULL - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_get_named_data_property (ecma_object_t *obj_p, /**< object to find property in */
|
||||
ecma_get_named_data_property (const ecma_object_ptr_t& obj_p, /**< object to find property in */
|
||||
ecma_string_t *name_p) /**< property's name */
|
||||
{
|
||||
JERRY_ASSERT (obj_p != NULL);
|
||||
JERRY_ASSERT (obj_p.is_not_null ());
|
||||
JERRY_ASSERT (name_p != NULL);
|
||||
|
||||
ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);
|
||||
@@ -676,10 +715,10 @@ ecma_get_named_data_property (ecma_object_t *obj_p, /**< object to find property
|
||||
* Free the named data property and values it references.
|
||||
*/
|
||||
static void
|
||||
ecma_free_named_data_property (ecma_object_t *object_p, /**< object the property belongs to */
|
||||
ecma_free_named_data_property (const ecma_object_ptr_t& object_p, /**< object the property belongs to */
|
||||
ecma_property_t *property_p) /**< the property */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
JERRY_ASSERT (property_p != NULL && property_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||
|
||||
ecma_lcache_invalidate (object_p, NULL, property_p);
|
||||
@@ -697,10 +736,10 @@ ecma_free_named_data_property (ecma_object_t *object_p, /**< object the property
|
||||
* Free the named accessor property and values it references.
|
||||
*/
|
||||
static void
|
||||
ecma_free_named_accessor_property (ecma_object_t *object_p, /**< object the property belongs to */
|
||||
ecma_free_named_accessor_property (const ecma_object_ptr_t& object_p, /**< object the property belongs to */
|
||||
ecma_property_t *property_p) /**< the property */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
JERRY_ASSERT (property_p != NULL && property_p->type == ECMA_PROPERTY_NAMEDACCESSOR);
|
||||
|
||||
ecma_lcache_invalidate (object_p, NULL, property_p);
|
||||
@@ -792,7 +831,7 @@ ecma_free_internal_property (ecma_property_t *property_p) /**< the property */
|
||||
* Free the property and values it references.
|
||||
*/
|
||||
void
|
||||
ecma_free_property (ecma_object_t *object_p, /**< object the property belongs to */
|
||||
ecma_free_property (const ecma_object_ptr_t& object_p, /**< object the property belongs to */
|
||||
ecma_property_t *prop_p) /**< property */
|
||||
{
|
||||
switch ((ecma_property_type_t) prop_p->type)
|
||||
@@ -826,7 +865,7 @@ ecma_free_property (ecma_object_t *object_p, /**< object the property belongs to
|
||||
* Warning: specified property must be owned by specified object.
|
||||
*/
|
||||
void
|
||||
ecma_delete_property (ecma_object_t *obj_p, /**< object */
|
||||
ecma_delete_property (const ecma_object_ptr_t& obj_p, /**< object */
|
||||
ecma_property_t *prop_p) /**< property */
|
||||
{
|
||||
for (ecma_property_t *cur_prop_p = ecma_get_property_list (obj_p), *prev_prop_p = NULL, *next_prop_p;
|
||||
@@ -892,7 +931,7 @@ ecma_set_named_data_property_value (ecma_property_t *prop_p, /**< property */
|
||||
* value previously stored in the property is freed
|
||||
*/
|
||||
void
|
||||
ecma_named_data_property_assign_value (ecma_object_t *obj_p, /**< object */
|
||||
ecma_named_data_property_assign_value (const ecma_object_ptr_t& obj_p, /**< object */
|
||||
ecma_property_t *prop_p, /**< property */
|
||||
const ecma_value_t& value) /**< value to assign */
|
||||
{
|
||||
@@ -1133,13 +1172,17 @@ ecma_free_property_descriptor (ecma_property_descriptor_t *prop_desc_p) /**< pro
|
||||
if (prop_desc_p->is_get_defined
|
||||
&& prop_desc_p->get_p != NULL)
|
||||
{
|
||||
ecma_deref_object (prop_desc_p->get_p);
|
||||
ecma_object_ptr_t get_p;
|
||||
get_p = prop_desc_p->get_p;
|
||||
ecma_deref_object (get_p);
|
||||
}
|
||||
|
||||
if (prop_desc_p->is_set_defined
|
||||
&& prop_desc_p->set_p != NULL)
|
||||
{
|
||||
ecma_deref_object (prop_desc_p->set_p);
|
||||
ecma_object_ptr_t set_p;
|
||||
set_p = prop_desc_p->set_p;
|
||||
ecma_deref_object (set_p);
|
||||
}
|
||||
|
||||
*prop_desc_p = ecma_make_empty_property_descriptor ();
|
||||
|
||||
@@ -131,60 +131,73 @@ extern bool
|
||||
ecma_collection_iterator_next (ecma_collection_iterator_t *iterator_p);
|
||||
|
||||
/* ecma-helpers.c */
|
||||
extern ecma_object_t* ecma_create_object (ecma_object_t *prototype_object_p,
|
||||
bool is_extensible,
|
||||
ecma_object_type_t type);
|
||||
extern ecma_object_t* ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p);
|
||||
extern ecma_object_t* ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p,
|
||||
ecma_object_t *binding_obj_p,
|
||||
bool provide_this);
|
||||
extern bool __attribute_pure__ ecma_is_lexical_environment (const ecma_object_t *object_p);
|
||||
extern bool __attribute_pure__ ecma_get_object_extensible (const ecma_object_t *object_p);
|
||||
extern void ecma_set_object_extensible (ecma_object_t *object_p, bool is_extensible);
|
||||
extern ecma_object_type_t __attribute_pure__ ecma_get_object_type (const ecma_object_t *object_p);
|
||||
extern void ecma_set_object_type (ecma_object_t *object_p, ecma_object_type_t type);
|
||||
extern ecma_object_t* __attribute_pure__ ecma_get_object_prototype (const ecma_object_t *object_p);
|
||||
extern bool __attribute_pure__ ecma_get_object_is_builtin (const ecma_object_t *object_p);
|
||||
extern void ecma_set_object_is_builtin (ecma_object_t *object_p,
|
||||
extern void
|
||||
ecma_create_object (ecma_object_ptr_t &ret_val,
|
||||
const ecma_object_ptr_t& prototype_object_p,
|
||||
bool is_extensible,
|
||||
ecma_object_type_t type);
|
||||
extern void
|
||||
ecma_create_decl_lex_env (ecma_object_ptr_t &ret_val,
|
||||
const ecma_object_ptr_t& outer_lexical_environment_p);
|
||||
extern void
|
||||
ecma_create_object_lex_env (ecma_object_ptr_t &ret_val,
|
||||
const ecma_object_ptr_t& outer_lexical_environment_p,
|
||||
const ecma_object_ptr_t& binding_obj_p,
|
||||
bool provide_this);
|
||||
extern bool __attribute_pure__ ecma_is_lexical_environment (const ecma_object_ptr_t& object_p);
|
||||
extern bool __attribute_pure__ ecma_get_object_extensible (const ecma_object_ptr_t& object_p);
|
||||
extern void ecma_set_object_extensible (const ecma_object_ptr_t& object_p, bool is_extensible);
|
||||
extern ecma_object_type_t __attribute_pure__ ecma_get_object_type (const ecma_object_ptr_t& object_p);
|
||||
extern void ecma_set_object_type (const ecma_object_ptr_t& object_p, ecma_object_type_t type);
|
||||
extern void
|
||||
ecma_get_object_prototype (ecma_object_ptr_t &ret_val,
|
||||
const ecma_object_ptr_t& object_p);
|
||||
extern bool __attribute_pure__ ecma_get_object_is_builtin (const ecma_object_ptr_t& object_p);
|
||||
extern void ecma_set_object_is_builtin (const ecma_object_ptr_t& object_p,
|
||||
bool is_builtin);
|
||||
extern ecma_lexical_environment_type_t __attribute_pure__ ecma_get_lex_env_type (const ecma_object_t *object_p);
|
||||
extern ecma_object_t* __attribute_pure__ ecma_get_lex_env_outer_reference (const ecma_object_t *object_p);
|
||||
extern ecma_property_t* __attribute_pure__ ecma_get_property_list (const ecma_object_t *object_p);
|
||||
extern ecma_object_t* __attribute_pure__ ecma_get_lex_env_binding_object (const ecma_object_t *object_p);
|
||||
extern bool __attribute_pure__ ecma_get_lex_env_provide_this (const ecma_object_t *object_p);
|
||||
extern ecma_lexical_environment_type_t __attribute_pure__
|
||||
ecma_get_lex_env_type (const ecma_object_ptr_t& object_p);
|
||||
extern void
|
||||
ecma_get_lex_env_outer_reference (ecma_object_ptr_t &ret_val,
|
||||
const ecma_object_ptr_t& object_p);
|
||||
extern ecma_property_t* __attribute_pure__ ecma_get_property_list (const ecma_object_ptr_t& object_p);
|
||||
extern void
|
||||
ecma_get_lex_env_binding_object (ecma_object_ptr_t &ret_val,
|
||||
const ecma_object_ptr_t& object_p);
|
||||
extern bool __attribute_pure__ ecma_get_lex_env_provide_this (const ecma_object_ptr_t& object_p);
|
||||
|
||||
extern ecma_property_t* ecma_create_internal_property (ecma_object_t *object_p,
|
||||
extern ecma_property_t* ecma_create_internal_property (const ecma_object_ptr_t& object_p,
|
||||
ecma_internal_property_id_t property_id);
|
||||
extern ecma_property_t* ecma_find_internal_property (ecma_object_t *object_p,
|
||||
extern ecma_property_t* ecma_find_internal_property (const ecma_object_ptr_t& object_p,
|
||||
ecma_internal_property_id_t property_id);
|
||||
extern ecma_property_t* ecma_get_internal_property (ecma_object_t *object_p,
|
||||
extern ecma_property_t* ecma_get_internal_property (const ecma_object_ptr_t& object_p,
|
||||
ecma_internal_property_id_t property_id);
|
||||
|
||||
extern ecma_property_t *ecma_create_named_data_property (ecma_object_t *obj_p,
|
||||
extern ecma_property_t *ecma_create_named_data_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *name_p,
|
||||
bool is_writable,
|
||||
bool is_enumerable,
|
||||
bool is_configurable);
|
||||
extern ecma_property_t *ecma_create_named_accessor_property (ecma_object_t *obj_p,
|
||||
extern ecma_property_t *ecma_create_named_accessor_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *name_p,
|
||||
ecma_object_t *get_p,
|
||||
ecma_object_t *set_p,
|
||||
const ecma_object_ptr_t& get_p,
|
||||
const ecma_object_ptr_t& set_p,
|
||||
bool is_enumerable,
|
||||
bool is_configurable);
|
||||
extern ecma_property_t *ecma_find_named_property (ecma_object_t *obj_p,
|
||||
extern ecma_property_t *ecma_find_named_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *name_p);
|
||||
extern ecma_property_t *ecma_get_named_property (ecma_object_t *obj_p,
|
||||
extern ecma_property_t *ecma_get_named_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *name_p);
|
||||
extern ecma_property_t *ecma_get_named_data_property (ecma_object_t *obj_p,
|
||||
extern ecma_property_t *ecma_get_named_data_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *name_p);
|
||||
|
||||
extern void ecma_free_property (ecma_object_t *obj_p, ecma_property_t *prop_p);
|
||||
extern void ecma_free_property (const ecma_object_ptr_t& obj_p, ecma_property_t *prop_p);
|
||||
|
||||
extern void ecma_delete_property (ecma_object_t *obj_p, ecma_property_t *prop_p);
|
||||
extern void ecma_delete_property (const ecma_object_ptr_t& obj_p, ecma_property_t *prop_p);
|
||||
|
||||
extern void ecma_get_named_data_property_value (ecma_value_t &ret, const ecma_property_t *prop_p);
|
||||
extern void ecma_set_named_data_property_value (ecma_property_t *prop_p, const ecma_value_t& value);
|
||||
extern void ecma_named_data_property_assign_value (ecma_object_t *obj_p,
|
||||
extern void ecma_named_data_property_assign_value (const ecma_object_ptr_t& obj_p,
|
||||
ecma_property_t *prop_p,
|
||||
const ecma_value_t& value);
|
||||
|
||||
|
||||
@@ -84,8 +84,9 @@ ecma_lcache_invalidate_entry (ecma_lcache_hash_entry_t *entry_p) /**< entry to i
|
||||
JERRY_ASSERT (entry_p != NULL);
|
||||
JERRY_ASSERT (entry_p->object_cp != ECMA_NULL_POINTER);
|
||||
|
||||
ecma_deref_object (ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
entry_p->object_cp));
|
||||
ecma_object_ptr_t entry_object_p;
|
||||
entry_object_p.unpack_from (entry_p->object_cp);
|
||||
ecma_deref_object (entry_object_p);
|
||||
|
||||
entry_p->object_cp = ECMA_NULL_POINTER;
|
||||
ecma_deref_ecma_string (ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
@@ -122,11 +123,11 @@ ecma_lcache_invalidate_all (void)
|
||||
*/
|
||||
static void
|
||||
ecma_lcache_invalidate_row_for_object_property_pair (uint32_t row_index, /**< index of the row */
|
||||
unsigned int object_cp, /**< compressed pointer
|
||||
* to an object */
|
||||
unsigned property_cp) /**< compressed pointer
|
||||
* to the object's
|
||||
* property */
|
||||
uintptr_t object_cp, /**< compressed pointer
|
||||
* to an object */
|
||||
uintptr_t property_cp) /**< compressed pointer
|
||||
* to the object's
|
||||
* property */
|
||||
{
|
||||
for (uint32_t entry_index = 0; entry_index < ECMA_LCACHE_HASH_ROW_LENGTH; entry_index++)
|
||||
{
|
||||
@@ -142,13 +143,13 @@ ecma_lcache_invalidate_row_for_object_property_pair (uint32_t row_index, /**< in
|
||||
* Insert an entry into LCache
|
||||
*/
|
||||
void
|
||||
ecma_lcache_insert (ecma_object_t *object_p, /**< object */
|
||||
ecma_lcache_insert (const ecma_object_ptr_t& object_p, /**< object */
|
||||
ecma_string_t *prop_name_p, /**< property's name */
|
||||
ecma_property_t *prop_p) /**< pointer to associated property or NULL
|
||||
* (NULL indicates that the object doesn't have property
|
||||
* with the name specified) */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
JERRY_ASSERT (prop_name_p != NULL);
|
||||
|
||||
prop_name_p = ecma_copy_or_ref_ecma_string (prop_name_p);
|
||||
@@ -169,9 +170,9 @@ ecma_lcache_insert (ecma_object_t *object_p, /**< object */
|
||||
&& ecma_lcache_hash_table[hash_key][entry_index].prop_cp == prop_cp)
|
||||
{
|
||||
#ifndef JERRY_NDEBUG
|
||||
ecma_object_t* obj_in_entry_p;
|
||||
obj_in_entry_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
ecma_lcache_hash_table[hash_key][entry_index].object_cp);
|
||||
ecma_object_ptr_t obj_in_entry_p;
|
||||
obj_in_entry_p.unpack_from (ecma_lcache_hash_table[hash_key][entry_index].object_cp);
|
||||
|
||||
JERRY_ASSERT (obj_in_entry_p == object_p);
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
break;
|
||||
@@ -207,7 +208,10 @@ ecma_lcache_insert (ecma_object_t *object_p, /**< object */
|
||||
}
|
||||
|
||||
ecma_ref_object (object_p);
|
||||
ECMA_SET_NON_NULL_POINTER (ecma_lcache_hash_table[ hash_key ][ entry_index ].object_cp, object_p);
|
||||
{
|
||||
ecma_object_t *object_tmp_p = (ecma_object_t*) object_p;
|
||||
ECMA_SET_NON_NULL_POINTER (ecma_lcache_hash_table[ hash_key ][ entry_index ].object_cp, object_tmp_p);
|
||||
}
|
||||
ECMA_SET_NON_NULL_POINTER (ecma_lcache_hash_table[ hash_key ][ entry_index ].prop_name_cp, prop_name_p);
|
||||
ECMA_SET_POINTER (ecma_lcache_hash_table[ hash_key ][ entry_index ].prop_cp, prop_p);
|
||||
} /* ecma_lcache_insert */
|
||||
@@ -219,7 +223,7 @@ ecma_lcache_insert (ecma_object_t *object_p, /**< object */
|
||||
* false - probably, not registered.
|
||||
*/
|
||||
bool __attribute_always_inline__
|
||||
ecma_lcache_lookup (ecma_object_t *object_p, /**< object */
|
||||
ecma_lcache_lookup (const ecma_object_ptr_t& object_p, /**< object */
|
||||
const ecma_string_t *prop_name_p, /**< property's name */
|
||||
ecma_property_t **prop_p_p) /**< out: if return value is true,
|
||||
* then here will be pointer to property,
|
||||
@@ -230,8 +234,8 @@ ecma_lcache_lookup (ecma_object_t *object_p, /**< object */
|
||||
{
|
||||
ecma_string_hash_t hash_key = ecma_string_hash (prop_name_p);
|
||||
|
||||
unsigned int object_cp;
|
||||
ECMA_SET_NON_NULL_POINTER (object_cp, object_p);
|
||||
uintptr_t object_cp;
|
||||
object_p.pack_to (object_cp);
|
||||
|
||||
for (uint32_t i = 0; i < ECMA_LCACHE_HASH_ROW_LENGTH; i++)
|
||||
{
|
||||
@@ -269,11 +273,11 @@ ecma_lcache_lookup (ecma_object_t *object_p, /**< object */
|
||||
* from property's description.
|
||||
*/
|
||||
void
|
||||
ecma_lcache_invalidate (ecma_object_t *object_p, /**< object */
|
||||
ecma_lcache_invalidate (const ecma_object_ptr_t& object_p, /**< object */
|
||||
ecma_string_t *prop_name_arg_p, /**< property's name (See also: Note) */
|
||||
ecma_property_t *prop_p) /**< property (See also: Note) */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL);
|
||||
JERRY_ASSERT (object_p.is_not_null ());
|
||||
JERRY_ASSERT (prop_p != NULL || prop_name_arg_p != NULL);
|
||||
|
||||
ecma_string_t *prop_name_p = NULL;
|
||||
@@ -308,8 +312,8 @@ ecma_lcache_invalidate (ecma_object_t *object_p, /**< object */
|
||||
prop_name_p = prop_name_arg_p;
|
||||
}
|
||||
|
||||
unsigned int object_cp, prop_cp;
|
||||
ECMA_SET_NON_NULL_POINTER (object_cp, object_p);
|
||||
uintptr_t object_cp, prop_cp;
|
||||
object_p.pack_to (object_cp);
|
||||
ECMA_SET_POINTER (prop_cp, prop_p);
|
||||
|
||||
ecma_string_hash_t hash_key = ecma_string_hash (prop_name_p);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,9 +25,15 @@
|
||||
|
||||
extern void ecma_lcache_init (void);
|
||||
extern void ecma_lcache_invalidate_all (void);
|
||||
extern void ecma_lcache_insert (ecma_object_t *object_p, ecma_string_t *prop_name_p, ecma_property_t *prop_p);
|
||||
extern bool ecma_lcache_lookup (ecma_object_t *object_p, const ecma_string_t *prop_name_p, ecma_property_t **prop_p_p);
|
||||
extern void ecma_lcache_invalidate (ecma_object_t *object_p, ecma_string_t *prop_name_arg_p, ecma_property_t *prop_p);
|
||||
extern void ecma_lcache_insert (const ecma_object_ptr_t& object_p, ecma_string_t *prop_name_p, ecma_property_t *prop_p);
|
||||
extern bool
|
||||
ecma_lcache_lookup (const ecma_object_ptr_t& object_p,
|
||||
const ecma_string_t *prop_name_p,
|
||||
ecma_property_t **prop_p_p);
|
||||
extern void
|
||||
ecma_lcache_invalidate (const ecma_object_ptr_t& object_p,
|
||||
ecma_string_t *prop_name_arg_p,
|
||||
ecma_property_t *prop_p);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -50,10 +50,11 @@ ecma_get_string_from_value (const ecma_value_t& value) /**< ecma-value */
|
||||
*
|
||||
* @return the pointer
|
||||
*/
|
||||
ecma_object_t* __attribute_pure__
|
||||
ecma_get_object_from_value (const ecma_value_t& value) /**< ecma-value */
|
||||
void
|
||||
ecma_get_object_from_value (ecma_object_ptr_t &ret_val, /**< out: object pointer */
|
||||
const ecma_value_t& value) /**< ecma-value */
|
||||
{
|
||||
return value.get_object ();
|
||||
ret_val = value.get_object ();
|
||||
} /* ecma_get_object_from_value */
|
||||
|
||||
/**
|
||||
@@ -114,7 +115,8 @@ ecma_copy_value (ecma_value_t &ret, /**< out: ecma-value */
|
||||
}
|
||||
case ECMA_TYPE_OBJECT:
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (value);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, value);
|
||||
|
||||
if (do_ref_if_object)
|
||||
{
|
||||
@@ -162,7 +164,9 @@ ecma_free_value (ecma_value_t& value, /**< value description */
|
||||
{
|
||||
if (do_deref_if_object)
|
||||
{
|
||||
ecma_deref_object (ecma_get_object_from_value (value));
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, value);
|
||||
ecma_deref_object (obj_p);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -176,9 +180,9 @@ ecma_free_value (ecma_value_t& value, /**< value description */
|
||||
*/
|
||||
void
|
||||
ecma_make_throw_obj_completion_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *exception_p) /**< an object */
|
||||
const ecma_object_ptr_t& exception_p) /**< an object */
|
||||
{
|
||||
JERRY_ASSERT(exception_p != NULL
|
||||
JERRY_ASSERT(exception_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (exception_p));
|
||||
|
||||
ecma_value_t exception (exception_p);
|
||||
|
||||
@@ -80,12 +80,18 @@ class ecma_value_t
|
||||
}
|
||||
|
||||
__attribute_always_inline__
|
||||
explicit ecma_value_t (ecma_object_t *obj_p)
|
||||
explicit ecma_value_t (ecma_object_t* obj_p)
|
||||
{
|
||||
*this = obj_p;
|
||||
}
|
||||
|
||||
__attribute_always_inline__
|
||||
explicit ecma_value_t (const ecma_object_ptr_t& obj_p)
|
||||
{
|
||||
*this = obj_p;
|
||||
}
|
||||
|
||||
__attribute_always_inline__
|
||||
explicit ecma_value_t (ecma_value_packed_t v)
|
||||
{
|
||||
*this = v;
|
||||
@@ -151,7 +157,7 @@ class ecma_value_t
|
||||
}
|
||||
|
||||
__attribute_always_inline__
|
||||
ecma_value_t& operator = (ecma_object_t *obj_p)
|
||||
ecma_value_t& operator = (ecma_object_t* obj_p)
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL);
|
||||
|
||||
@@ -161,6 +167,17 @@ class ecma_value_t
|
||||
return *this;
|
||||
}
|
||||
|
||||
__attribute_always_inline__
|
||||
ecma_value_t& operator = (const ecma_object_ptr_t& obj_p)
|
||||
{
|
||||
JERRY_ASSERT (obj_p.is_not_null ());
|
||||
|
||||
_type = ECMA_TYPE_OBJECT;
|
||||
_value_p = obj_p;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
__attribute_always_inline__
|
||||
ecma_value_t& operator = (ecma_value_packed_t packed)
|
||||
{
|
||||
@@ -491,7 +508,9 @@ ecma_is_value_object (const ecma_value_t& value) /**< ecma-value */
|
||||
|
||||
extern ecma_number_t* __attribute_pure__ ecma_get_number_from_value (const ecma_value_t& value);
|
||||
extern ecma_string_t* __attribute_pure__ ecma_get_string_from_value (const ecma_value_t& value);
|
||||
extern ecma_object_t* __attribute_pure__ ecma_get_object_from_value (const ecma_value_t& value);
|
||||
extern void
|
||||
ecma_get_object_from_value (ecma_object_ptr_t &ret_val,
|
||||
const ecma_value_t& value);
|
||||
extern void ecma_copy_value (ecma_value_t &ret, const ecma_value_t& value, bool do_ref_if_object);
|
||||
extern void ecma_free_value (ecma_value_t& value, bool do_deref_if_object);
|
||||
|
||||
@@ -569,7 +588,9 @@ ecma_make_throw_completion_value (ecma_completion_value_t &ret_value, /**< out:
|
||||
#endif /* !CONFIG_ECMA_EXCEPTION_SUPPORT */
|
||||
} /* ecma_make_throw_completion_value */
|
||||
|
||||
extern void ecma_make_throw_obj_completion_value (ecma_completion_value_t &ret_value, ecma_object_t *exception_p);
|
||||
extern void
|
||||
ecma_make_throw_obj_completion_value (ecma_completion_value_t &ret_value,
|
||||
const ecma_object_ptr_t& exception_p);
|
||||
|
||||
/**
|
||||
* Empty completion value constructor.
|
||||
|
||||
@@ -43,7 +43,9 @@ ecma_reject (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
{
|
||||
if (is_throw)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -87,7 +89,9 @@ ecma_op_create_array_object (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
uint32_t num_uint32 = ecma_number_to_uint32 (*num_p);
|
||||
if (*num_p != ecma_uint32_to_number (num_uint32))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_RANGE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_RANGE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -105,12 +109,15 @@ ecma_op_create_array_object (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
}
|
||||
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN
|
||||
ecma_object_t *array_prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);
|
||||
ecma_object_ptr_t array_prototype_obj_p;
|
||||
ecma_builtin_get (array_prototype_obj_p, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);
|
||||
#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN */
|
||||
ecma_object_t *array_prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
ecma_object_ptr_t array_prototype_obj_p;
|
||||
ecma_builtin_get (array_prototype_obj_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN */
|
||||
|
||||
ecma_object_t *obj_p = ecma_create_object (array_prototype_obj_p, true, ECMA_OBJECT_TYPE_ARRAY);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_create_object (obj_p, array_prototype_obj_p, true, ECMA_OBJECT_TYPE_ARRAY);
|
||||
ecma_deref_object (array_prototype_obj_p);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
@@ -174,7 +181,7 @@ ecma_op_create_array_object (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
*/
|
||||
void
|
||||
ecma_op_array_object_define_own_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the array object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the array object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_property_descriptor_t* property_desc_p, /**< property descriptor */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
@@ -235,7 +242,9 @@ ecma_op_array_object_define_own_property (ecma_completion_value_t &ret_value, /*
|
||||
// d.
|
||||
if (ecma_uint32_to_number (new_len_uint32) != new_len_num)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_RANGE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_RANGE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -34,7 +34,7 @@ ecma_op_create_array_object (ecma_completion_value_t &ret_value,
|
||||
|
||||
extern void
|
||||
ecma_op_array_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_property_descriptor_t* property_desc_p,
|
||||
bool is_throw);
|
||||
|
||||
@@ -55,14 +55,15 @@ ecma_op_create_boolean_object (ecma_completion_value_t &ret_value, /**< out: com
|
||||
ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE);
|
||||
#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_BOOLEAN_BUILTIN */
|
||||
|
||||
ecma_object_t *obj_p = ecma_create_object (prototype_obj_p,
|
||||
true,
|
||||
ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_create_object (obj_p, prototype_obj_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -121,7 +121,11 @@ ecma_op_abstract_equality_compare (ecma_completion_value_t &ret_value, /**< out:
|
||||
{ // f.
|
||||
JERRY_ASSERT(is_x_object);
|
||||
|
||||
bool is_equal = (ecma_get_object_from_value (x) == ecma_get_object_from_value (y));
|
||||
ecma_object_ptr_t x_obj_p, y_obj_p;
|
||||
ecma_get_object_from_value (x_obj_p, x);
|
||||
ecma_get_object_from_value (y_obj_p, y);
|
||||
|
||||
bool is_equal = (x_obj_p == y_obj_p);
|
||||
|
||||
ecma_make_simple_completion_value (ret_value, is_equal ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE);
|
||||
}
|
||||
@@ -302,7 +306,11 @@ ecma_op_strict_equality_compare (const ecma_value_t& x, /**< first operand */
|
||||
// 7. Return true if x and y refer to the same object. Otherwise, return false.
|
||||
JERRY_ASSERT (is_x_object);
|
||||
|
||||
return (ecma_get_object_from_value (x) == ecma_get_object_from_value (y));
|
||||
ecma_object_ptr_t x_obj_p, y_obj_p;
|
||||
ecma_get_object_from_value (x_obj_p, x);
|
||||
ecma_get_object_from_value (y_obj_p, y);
|
||||
|
||||
return (x_obj_p == y_obj_p);
|
||||
} /* ecma_op_strict_equality_compare */
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,7 +57,9 @@ ecma_op_check_object_coercible (ecma_completion_value_t &ret_value, /**< out: co
|
||||
if (ecma_is_value_undefined (value)
|
||||
|| ecma_is_value_null (value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -145,7 +147,11 @@ ecma_op_same_value (const ecma_value_t& x, /**< ecma-value */
|
||||
|
||||
JERRY_ASSERT(is_x_object);
|
||||
|
||||
return (ecma_get_object_from_value (x) == ecma_get_object_from_value (y));
|
||||
ecma_object_ptr_t x_obj_p, y_obj_p;
|
||||
ecma_get_object_from_value (x_obj_p, x);
|
||||
ecma_get_object_from_value (y_obj_p, y);
|
||||
|
||||
return (x_obj_p == y_obj_p);
|
||||
} /* ecma_op_same_value */
|
||||
|
||||
/**
|
||||
@@ -166,7 +172,8 @@ ecma_op_to_primitive (ecma_completion_value_t &ret_value, /**< out: completion v
|
||||
|
||||
if (ecma_is_value_object (value))
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (value);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, value);
|
||||
|
||||
ecma_op_object_default_value (ret_value, obj_p, preferred_type);
|
||||
}
|
||||
@@ -413,7 +420,9 @@ ecma_op_to_object (ecma_completion_value_t &ret_value, /**< out: completion valu
|
||||
if (ecma_is_value_undefined (value)
|
||||
|| ecma_is_value_null (value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -432,11 +441,12 @@ ecma_op_to_object (ecma_completion_value_t &ret_value, /**< out: completion valu
|
||||
*
|
||||
* @return constructed object
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_desc_p) /**< property descriptor */
|
||||
void
|
||||
ecma_op_from_property_descriptor (ecma_object_ptr_t &obj_p, /**< out: object pointer */
|
||||
const ecma_property_descriptor_t* src_prop_desc_p) /**< property descriptor */
|
||||
{
|
||||
// 2.
|
||||
ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
|
||||
ecma_op_create_object_object_noarg (obj_p);
|
||||
|
||||
ecma_completion_value_t completion;
|
||||
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
|
||||
@@ -554,8 +564,6 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_des
|
||||
false);
|
||||
ecma_deref_ecma_string (configurable_magic_string_p);
|
||||
JERRY_ASSERT (ecma_is_completion_value_normal_true (completion));
|
||||
|
||||
return obj_p;
|
||||
} /* ecma_op_from_property_descriptor */
|
||||
|
||||
/**
|
||||
@@ -579,11 +587,14 @@ ecma_op_to_property_descriptor (ecma_completion_value_t &ret_value, /**< out: co
|
||||
// 1.
|
||||
if (!ecma_is_value_object (obj_value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, obj_value);
|
||||
|
||||
// 2.
|
||||
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
|
||||
@@ -713,7 +724,9 @@ ecma_op_to_property_descriptor (ecma_completion_value_t &ret_value, /**< out: co
|
||||
if (!ecma_op_is_callable (get_prop_value)
|
||||
&& !ecma_is_value_undefined (get_prop_value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -727,10 +740,11 @@ ecma_op_to_property_descriptor (ecma_completion_value_t &ret_value, /**< out: co
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_value_object (get_prop_value));
|
||||
|
||||
ecma_object_t *get_p = ecma_get_object_from_value (get_prop_value);
|
||||
ecma_object_ptr_t get_p;
|
||||
ecma_get_object_from_value (get_p, get_prop_value);
|
||||
ecma_ref_object (get_p);
|
||||
|
||||
prop_desc.get_p = get_p;
|
||||
prop_desc.get_p = (ecma_object_t*) get_p;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -755,7 +769,9 @@ ecma_op_to_property_descriptor (ecma_completion_value_t &ret_value, /**< out: co
|
||||
if (!ecma_op_is_callable (set_prop_value)
|
||||
&& !ecma_is_value_undefined (set_prop_value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -769,10 +785,11 @@ ecma_op_to_property_descriptor (ecma_completion_value_t &ret_value, /**< out: co
|
||||
{
|
||||
JERRY_ASSERT (ecma_is_value_object (set_prop_value));
|
||||
|
||||
ecma_object_t *set_p = ecma_get_object_from_value (set_prop_value);
|
||||
ecma_object_ptr_t set_p;
|
||||
ecma_get_object_from_value (set_p, set_prop_value);
|
||||
ecma_ref_object (set_p);
|
||||
|
||||
prop_desc.set_p = set_p;
|
||||
prop_desc.set_p = (ecma_object_t*) set_p;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -793,7 +810,9 @@ ecma_op_to_property_descriptor (ecma_completion_value_t &ret_value, /**< out: co
|
||||
if (prop_desc.is_value_defined
|
||||
|| prop_desc.is_writable_defined)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,8 +60,9 @@ extern void
|
||||
ecma_op_to_object (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value);
|
||||
|
||||
extern ecma_object_t*
|
||||
ecma_op_from_property_descriptor (const ecma_property_descriptor_t* src_prop_desc_p);
|
||||
extern void
|
||||
ecma_op_from_property_descriptor (ecma_object_ptr_t &ret_val,
|
||||
const ecma_property_descriptor_t* src_prop_desc_p);
|
||||
extern void
|
||||
ecma_op_to_property_descriptor (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& obj_value,
|
||||
|
||||
@@ -35,8 +35,9 @@
|
||||
* @return pointer to ecma-object representing specified error
|
||||
* with reference counter set to one.
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error type */
|
||||
void
|
||||
ecma_new_standard_error (ecma_object_ptr_t &new_error_obj_p, /**< out: object pointer */
|
||||
ecma_standard_error_t error_type) /**< native error type */
|
||||
{
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS
|
||||
ecma_builtin_id_t prototype_id = ECMA_BUILTIN_ID__COUNT;
|
||||
@@ -86,23 +87,20 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ
|
||||
}
|
||||
}
|
||||
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, prototype_id);
|
||||
|
||||
ecma_object_t *new_error_obj_p = ecma_create_object (prototype_obj_p,
|
||||
true,
|
||||
ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_create_object (new_error_obj_p, prototype_obj_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (new_error_obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
class_prop_p->u.internal_property.value = ECMA_MAGIC_STRING_ERROR_UL;
|
||||
|
||||
return new_error_obj_p;
|
||||
#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */
|
||||
(void) error_type;
|
||||
|
||||
return ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR);
|
||||
ecma_builtin_get (new_error_obj_p, ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR);
|
||||
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ERROR_BUILTINS */
|
||||
} /* ecma_new_standard_error */
|
||||
|
||||
@@ -112,11 +110,12 @@ ecma_new_standard_error (ecma_standard_error_t error_type) /**< native error typ
|
||||
* @return pointer to ecma-object representing specified error
|
||||
* with reference counter set to one.
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_new_standard_error_with_message (ecma_standard_error_t error_type, /**< native error type */
|
||||
void
|
||||
ecma_new_standard_error_with_message (ecma_object_ptr_t &new_error_obj_p, /**< out: object pointer */
|
||||
ecma_standard_error_t error_type, /**< native error type */
|
||||
ecma_string_t* message_string_p) /**< message string */
|
||||
{
|
||||
ecma_object_t *new_error_obj_p = ecma_new_standard_error (error_type);
|
||||
ecma_new_standard_error (new_error_obj_p, error_type);
|
||||
|
||||
ecma_string_t *message_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_MESSAGE);
|
||||
ecma_property_t *prop_p = ecma_create_named_data_property (new_error_obj_p,
|
||||
@@ -126,8 +125,6 @@ ecma_new_standard_error_with_message (ecma_standard_error_t error_type, /**< nat
|
||||
ecma_set_named_data_property_value (prop_p,
|
||||
ecma_value_t (ecma_copy_or_ref_ecma_string (message_string_p)));
|
||||
ecma_deref_ecma_string (message_magic_string_p);
|
||||
|
||||
return new_error_obj_p;
|
||||
} /* ecma_new_standard_error_with_message */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,9 +44,13 @@ typedef enum
|
||||
ECMA_ERROR_URI /**< URIError */
|
||||
} ecma_standard_error_t;
|
||||
|
||||
extern ecma_object_t *ecma_new_standard_error (ecma_standard_error_t error_type);
|
||||
extern ecma_object_t* ecma_new_standard_error_with_message (ecma_standard_error_t error_type,
|
||||
ecma_string_t *message_string_p);
|
||||
extern void
|
||||
ecma_new_standard_error (ecma_object_ptr_t &ret_val,
|
||||
ecma_standard_error_t error_type);
|
||||
extern void
|
||||
ecma_new_standard_error_with_message (ecma_object_ptr_t &ret_val,
|
||||
ecma_standard_error_t error_type,
|
||||
ecma_string_t *message_string_p);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -94,9 +94,10 @@ ecma_op_is_callable (const ecma_value_t& value) /**< ecma-value */
|
||||
return false;
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (value);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, value);
|
||||
|
||||
JERRY_ASSERT(obj_p != NULL);
|
||||
JERRY_ASSERT(obj_p.is_not_null ());
|
||||
JERRY_ASSERT(!ecma_is_lexical_environment (obj_p));
|
||||
|
||||
return (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_FUNCTION
|
||||
@@ -118,9 +119,10 @@ ecma_is_constructor (const ecma_value_t& value) /**< ecma-value */
|
||||
return false;
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (value);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, value);
|
||||
|
||||
JERRY_ASSERT(obj_p != NULL);
|
||||
JERRY_ASSERT(obj_p.is_not_null ());
|
||||
JERRY_ASSERT(!ecma_is_lexical_environment (obj_p));
|
||||
|
||||
return (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_FUNCTION
|
||||
@@ -134,17 +136,19 @@ ecma_is_constructor (const ecma_value_t& value) /**< ecma-value */
|
||||
*
|
||||
* @return pointer to newly created Function object
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< formal parameters list */
|
||||
void
|
||||
ecma_op_create_function_object (ecma_object_ptr_t &function_obj_p, /**< out: object pointer */
|
||||
ecma_string_t* formal_parameter_list_p[], /**< formal parameters list */
|
||||
ecma_length_t formal_parameters_number, /**< formal parameters list's length */
|
||||
ecma_object_t *scope_p, /**< function's scope */
|
||||
const ecma_object_ptr_t& scope_p, /**< function's scope */
|
||||
bool is_strict, /**< 'strict' flag */
|
||||
opcode_counter_t first_opcode_idx) /**< index of first opcode of function's body */
|
||||
{
|
||||
// 1., 4., 13.
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
|
||||
|
||||
ecma_object_t *f = ecma_create_object (prototype_obj_p, true, ECMA_OBJECT_TYPE_FUNCTION);
|
||||
ecma_create_object (function_obj_p, prototype_obj_p, true, ECMA_OBJECT_TYPE_FUNCTION);
|
||||
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
@@ -156,16 +160,19 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
*/
|
||||
|
||||
// 3.
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (function_obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
class_prop_p->u.internal_property.value = ECMA_MAGIC_STRING_FUNCTION_UL;
|
||||
|
||||
// 9.
|
||||
ecma_property_t *scope_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
ECMA_SET_POINTER(scope_prop_p->u.internal_property.value, scope_p);
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (f, scope_p);
|
||||
ecma_property_t *scope_prop_p = ecma_create_internal_property (function_obj_p, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
{
|
||||
ecma_object_t *scope_tmp_p = (ecma_object_t*) scope_p;
|
||||
ECMA_SET_POINTER(scope_prop_p->u.internal_property.value, scope_tmp_p);
|
||||
}
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (function_obj_p, scope_p);
|
||||
|
||||
// 10., 11.
|
||||
ecma_property_t *formal_parameters_prop_p = ecma_create_internal_property (f,
|
||||
ecma_property_t *formal_parameters_prop_p = ecma_create_internal_property (function_obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_FORMAL_PARAMETERS);
|
||||
if (formal_parameters_number != 0)
|
||||
{
|
||||
@@ -179,7 +186,7 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
}
|
||||
|
||||
// 12.
|
||||
ecma_property_t *code_prop_p = ecma_create_internal_property (f, ECMA_INTERNAL_PROPERTY_CODE);
|
||||
ecma_property_t *code_prop_p = ecma_create_internal_property (function_obj_p, ECMA_INTERNAL_PROPERTY_CODE);
|
||||
code_prop_p->u.internal_property.value = ecma_pack_code_internal_property_value (is_strict,
|
||||
first_opcode_idx);
|
||||
|
||||
@@ -195,7 +202,7 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
ecma_string_t* magic_string_length_p = ecma_get_magic_string (ECMA_MAGIC_STRING_LENGTH);
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_object_define_own_property (completion,
|
||||
f,
|
||||
function_obj_p,
|
||||
magic_string_length_p,
|
||||
&length_prop_desc,
|
||||
false);
|
||||
@@ -208,13 +215,14 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
len_p = NULL;
|
||||
|
||||
// 16.
|
||||
ecma_object_t *proto_p = ecma_op_create_object_object_noarg ();
|
||||
ecma_object_ptr_t proto_p;
|
||||
ecma_op_create_object_object_noarg (proto_p);
|
||||
|
||||
// 17.
|
||||
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
|
||||
{
|
||||
prop_desc.is_value_defined = true;
|
||||
prop_desc.value = (ecma_value_packed_t) ecma_value_t (f);
|
||||
prop_desc.value = (ecma_value_packed_t) ecma_value_t (function_obj_p);
|
||||
|
||||
prop_desc.is_writable_defined = true;
|
||||
prop_desc.is_writable = true;
|
||||
@@ -242,7 +250,7 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
prop_desc.is_configurable = false;
|
||||
ecma_string_t *magic_string_prototype_p = ecma_get_magic_string (ECMA_MAGIC_STRING_PROTOTYPE);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
f,
|
||||
function_obj_p,
|
||||
magic_string_prototype_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
@@ -256,7 +264,8 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
// 19.
|
||||
if (is_strict)
|
||||
{
|
||||
ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
|
||||
ecma_object_ptr_t thrower_p;
|
||||
ecma_builtin_get (thrower_p, ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
|
||||
|
||||
prop_desc = ecma_make_empty_property_descriptor ();
|
||||
{
|
||||
@@ -267,15 +276,15 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
prop_desc.is_configurable = false;
|
||||
|
||||
prop_desc.is_get_defined = true;
|
||||
prop_desc.get_p = thrower_p;
|
||||
prop_desc.get_p = (ecma_object_t*) thrower_p;
|
||||
|
||||
prop_desc.is_set_defined = true;
|
||||
prop_desc.set_p = thrower_p;
|
||||
prop_desc.set_p = (ecma_object_t*) thrower_p;
|
||||
}
|
||||
|
||||
ecma_string_t *magic_string_caller_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CALLER);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
f,
|
||||
function_obj_p,
|
||||
magic_string_caller_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
@@ -286,7 +295,7 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
|
||||
ecma_string_t *magic_string_arguments_p = ecma_get_magic_string (ECMA_MAGIC_STRING_ARGUMENTS);
|
||||
ecma_op_object_define_own_property (completion,
|
||||
f,
|
||||
function_obj_p,
|
||||
magic_string_arguments_p,
|
||||
&prop_desc,
|
||||
false);
|
||||
@@ -297,8 +306,6 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
|
||||
ecma_deref_object (thrower_p);
|
||||
}
|
||||
|
||||
return f;
|
||||
} /* ecma_op_create_function_object */
|
||||
|
||||
/**
|
||||
@@ -312,8 +319,8 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f
|
||||
*/
|
||||
static void
|
||||
ecma_function_call_setup_args_variables (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *func_obj_p, /**< Function object */
|
||||
ecma_object_t *env_p, /**< lexical environment */
|
||||
const ecma_object_ptr_t& func_obj_p, /**< Function object */
|
||||
const ecma_object_ptr_t& env_p, /**< lexical environment */
|
||||
const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len, /**< length of argument list */
|
||||
bool is_strict) /**< flag indicating strict mode */
|
||||
@@ -399,10 +406,10 @@ ecma_function_call_setup_args_variables (ecma_completion_value_t &ret_value, /**
|
||||
*/
|
||||
void
|
||||
ecma_op_function_has_instance (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *func_obj_p, /**< Function object */
|
||||
const ecma_object_ptr_t& func_obj_p, /**< Function object */
|
||||
const ecma_value_t& value) /**< argument 'V' */
|
||||
{
|
||||
JERRY_ASSERT(func_obj_p != NULL
|
||||
JERRY_ASSERT(func_obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (func_obj_p));
|
||||
|
||||
if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION)
|
||||
@@ -413,7 +420,8 @@ ecma_op_function_has_instance (ecma_completion_value_t &ret_value, /**< out: com
|
||||
return;
|
||||
}
|
||||
|
||||
ecma_object_t* v_obj_p = ecma_get_object_from_value (value);
|
||||
ecma_object_ptr_t v_obj_p;
|
||||
ecma_get_object_from_value (v_obj_p, value);
|
||||
|
||||
ecma_string_t *prototype_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_PROTOTYPE);
|
||||
|
||||
@@ -421,19 +429,22 @@ ecma_op_function_has_instance (ecma_completion_value_t &ret_value, /**< out: com
|
||||
|
||||
if (!ecma_is_value_object (prototype_obj_value))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *prototype_obj_p = ecma_get_object_from_value (prototype_obj_value);
|
||||
JERRY_ASSERT (prototype_obj_p != NULL);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_get_object_from_value (prototype_obj_p, prototype_obj_value);
|
||||
JERRY_ASSERT (prototype_obj_p.is_not_null ());
|
||||
|
||||
do
|
||||
{
|
||||
v_obj_p = ecma_get_object_prototype (v_obj_p);
|
||||
ecma_get_object_prototype (v_obj_p, v_obj_p);
|
||||
|
||||
if (v_obj_p == NULL)
|
||||
if (v_obj_p.is_null ())
|
||||
{
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_FALSE);
|
||||
|
||||
@@ -454,7 +465,9 @@ ecma_op_function_has_instance (ecma_completion_value_t &ret_value, /**< out: com
|
||||
}
|
||||
else if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -476,12 +489,12 @@ ecma_op_function_has_instance (ecma_completion_value_t &ret_value, /**< out: com
|
||||
*/
|
||||
void
|
||||
ecma_op_function_call (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *func_obj_p, /**< Function object */
|
||||
const ecma_object_ptr_t& func_obj_p, /**< Function object */
|
||||
const ecma_value_t& this_arg_value, /**< 'this' argument's value */
|
||||
const ecma_value_t* arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< length of arguments list */
|
||||
{
|
||||
JERRY_ASSERT(func_obj_p != NULL
|
||||
JERRY_ASSERT(func_obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (func_obj_p));
|
||||
JERRY_ASSERT(ecma_op_is_callable (ecma_value_t (func_obj_p)));
|
||||
JERRY_ASSERT(arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -499,8 +512,8 @@ ecma_op_function_call (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
ecma_property_t *scope_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
ecma_property_t *code_prop_p = ecma_get_internal_property (func_obj_p, ECMA_INTERNAL_PROPERTY_CODE);
|
||||
|
||||
ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
scope_prop_p->u.internal_property.value);
|
||||
ecma_object_ptr_t scope_p;
|
||||
scope_p.unpack_from (scope_prop_p->u.internal_property.value);
|
||||
uint32_t code_prop_value = code_prop_p->u.internal_property.value;
|
||||
|
||||
bool is_strict;
|
||||
@@ -517,7 +530,9 @@ ecma_op_function_call (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
|| ecma_is_value_null (this_arg_value))
|
||||
{
|
||||
// 2.
|
||||
this_binding = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL);
|
||||
ecma_object_ptr_t global_obj_p;
|
||||
ecma_builtin_get (global_obj_p, ECMA_BUILTIN_ID_GLOBAL);
|
||||
this_binding = global_obj_p;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -530,7 +545,8 @@ ecma_op_function_call (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
}
|
||||
|
||||
// 5.
|
||||
ecma_object_t *local_env_p = ecma_create_decl_lex_env (scope_p);
|
||||
ecma_object_ptr_t local_env_p;
|
||||
ecma_create_decl_lex_env (local_env_p, scope_p);
|
||||
|
||||
// 9.
|
||||
ECMA_TRY_CATCH (ret_value, ecma_function_call_setup_args_variables, args_var_declaration_ret,
|
||||
@@ -582,11 +598,11 @@ ecma_op_function_call (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
*/
|
||||
void
|
||||
ecma_op_function_construct (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *func_obj_p, /**< Function object */
|
||||
const ecma_object_ptr_t& func_obj_p, /**< Function object */
|
||||
const ecma_value_t* arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< length of arguments list */
|
||||
{
|
||||
JERRY_ASSERT(func_obj_p != NULL
|
||||
JERRY_ASSERT(func_obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (func_obj_p));
|
||||
JERRY_ASSERT(ecma_is_constructor (ecma_value_t (func_obj_p)));
|
||||
JERRY_ASSERT(arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
@@ -606,20 +622,21 @@ ecma_op_function_construct (ecma_completion_value_t &ret_value, /**< out: comple
|
||||
ecma_op_object_get, func_obj_prototype_prop_value, func_obj_p, prototype_magic_string_p);
|
||||
|
||||
// 6.
|
||||
ecma_object_t *prototype_p;
|
||||
ecma_object_ptr_t prototype_p;
|
||||
if (ecma_is_value_object (func_obj_prototype_prop_value))
|
||||
{
|
||||
prototype_p = ecma_get_object_from_value (func_obj_prototype_prop_value);
|
||||
ecma_get_object_from_value (prototype_p, func_obj_prototype_prop_value);
|
||||
ecma_ref_object (prototype_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 7.
|
||||
prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
ecma_builtin_get (prototype_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
}
|
||||
|
||||
// 1., 2., 4.
|
||||
ecma_object_t *obj_p = ecma_create_object (prototype_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_create_object (obj_p, prototype_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
|
||||
// 3.
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
@@ -671,7 +688,7 @@ ecma_op_function_construct (ecma_completion_value_t &ret_value, /**< out: comple
|
||||
*/
|
||||
void
|
||||
ecma_op_function_declaration (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_object_ptr_t& lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *function_name_p, /**< function name */
|
||||
opcode_counter_t function_code_opcode_idx, /**< index of first opcode of function code */
|
||||
ecma_string_t* formal_parameter_list_p[], /**< formal parameters list */
|
||||
@@ -681,11 +698,13 @@ ecma_op_function_declaration (ecma_completion_value_t &ret_value, /**< out: comp
|
||||
is declared in eval code */
|
||||
{
|
||||
// b.
|
||||
ecma_object_t *func_obj_p = ecma_op_create_function_object (formal_parameter_list_p,
|
||||
formal_parameter_list_length,
|
||||
lex_env_p,
|
||||
is_strict,
|
||||
function_code_opcode_idx);
|
||||
ecma_object_ptr_t func_obj_p;
|
||||
ecma_op_create_function_object (func_obj_p,
|
||||
formal_parameter_list_p,
|
||||
formal_parameter_list_length,
|
||||
lex_env_p,
|
||||
is_strict,
|
||||
function_code_opcode_idx);
|
||||
|
||||
// c.
|
||||
bool func_already_declared = ecma_op_has_binding (lex_env_p, function_name_p);
|
||||
@@ -704,7 +723,8 @@ ecma_op_function_declaration (ecma_completion_value_t &ret_value, /**< out: comp
|
||||
else if (ecma_is_lexical_environment_global (lex_env_p))
|
||||
{
|
||||
// e.
|
||||
ecma_object_t *glob_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL);
|
||||
ecma_object_ptr_t glob_obj_p;
|
||||
ecma_builtin_get (glob_obj_p, ECMA_BUILTIN_ID_GLOBAL);
|
||||
|
||||
ecma_property_t *existing_prop_p = ecma_op_object_get_property (glob_obj_p, function_name_p);
|
||||
|
||||
@@ -733,7 +753,9 @@ ecma_op_function_declaration (ecma_completion_value_t &ret_value, /**< out: comp
|
||||
}
|
||||
else if (existing_prop_p->type == ECMA_PROPERTY_NAMEDACCESSOR)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (completion, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (completion, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -742,7 +764,9 @@ ecma_op_function_declaration (ecma_completion_value_t &ret_value, /**< out: comp
|
||||
if (!ecma_is_property_writable (existing_prop_p)
|
||||
|| !ecma_is_property_enumerable (existing_prop_p))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (completion, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (completion, exception_obj_p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,34 +30,35 @@
|
||||
extern bool ecma_op_is_callable (const ecma_value_t& value);
|
||||
extern bool ecma_is_constructor (const ecma_value_t& value);
|
||||
|
||||
extern ecma_object_t*
|
||||
ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[],
|
||||
extern void
|
||||
ecma_op_create_function_object (ecma_object_ptr_t &ret_val,
|
||||
ecma_string_t* formal_parameter_list_p[],
|
||||
ecma_length_t formal_parameters_number,
|
||||
ecma_object_t *scope_p,
|
||||
const ecma_object_ptr_t& scope_p,
|
||||
bool is_strict,
|
||||
opcode_counter_t first_opcode_idx);
|
||||
|
||||
extern void
|
||||
ecma_op_function_call (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *func_obj_p,
|
||||
const ecma_object_ptr_t& func_obj_p,
|
||||
const ecma_value_t& this_arg_value,
|
||||
const ecma_value_t* arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
|
||||
extern void
|
||||
ecma_op_function_construct (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *func_obj_p,
|
||||
const ecma_object_ptr_t& func_obj_p,
|
||||
const ecma_value_t* arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
|
||||
extern void
|
||||
ecma_op_function_has_instance (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *func_obj_p,
|
||||
const ecma_object_ptr_t& func_obj_p,
|
||||
const ecma_value_t& value);
|
||||
|
||||
extern void
|
||||
ecma_op_function_declaration (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *function_name_p,
|
||||
opcode_counter_t function_code_opcode_idx,
|
||||
ecma_string_t* formal_parameter_list_p[],
|
||||
|
||||
@@ -45,21 +45,24 @@
|
||||
*/
|
||||
void
|
||||
ecma_op_get_value_lex_env_base (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *ref_base_lex_env_p, /**< reference's base (lexical environment) */
|
||||
const ecma_object_ptr_t& ref_base_lex_env_p, /**< reference's base
|
||||
* (lexical environment) */
|
||||
ecma_string_t *var_name_string_p, /**< variable name */
|
||||
bool is_strict) /**< flag indicating strict mode */
|
||||
{
|
||||
const bool is_unresolvable_reference = (ref_base_lex_env_p == NULL);
|
||||
const bool is_unresolvable_reference = (ref_base_lex_env_p.is_null ());
|
||||
|
||||
// 3.
|
||||
if (unlikely (is_unresolvable_reference))
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_REFERENCE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
|
||||
// 5.
|
||||
JERRY_ASSERT(ref_base_lex_env_p != NULL
|
||||
JERRY_ASSERT(ref_base_lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (ref_base_lex_env_p));
|
||||
|
||||
// 5.a
|
||||
@@ -86,8 +89,14 @@ ecma_op_get_value_object_base (ecma_completion_value_t &ret_value, /**< out: com
|
||||
const bool has_primitive_base = (ecma_is_value_boolean (base)
|
||||
|| ecma_is_value_number (base)
|
||||
|| ecma_is_value_string (base));
|
||||
const bool has_object_base = (ecma_is_value_object (base)
|
||||
&& !(ecma_is_lexical_environment (ecma_get_object_from_value (base))));
|
||||
bool has_object_base = false;
|
||||
if (ecma_is_value_object (base))
|
||||
{
|
||||
ecma_object_ptr_t base_obj_p;
|
||||
ecma_get_object_from_value (base_obj_p, base);
|
||||
|
||||
has_object_base = !ecma_is_lexical_environment (base_obj_p);
|
||||
}
|
||||
const bool is_property_reference = has_primitive_base || has_object_base;
|
||||
|
||||
JERRY_ASSERT (!is_unresolvable_reference);
|
||||
@@ -98,8 +107,9 @@ ecma_op_get_value_object_base (ecma_completion_value_t &ret_value, /**< out: com
|
||||
{
|
||||
// 4.b case 1
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (base);
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, base);
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
ecma_op_object_get (ret_value, obj_p, ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
@@ -110,8 +120,9 @@ ecma_op_get_value_object_base (ecma_completion_value_t &ret_value, /**< out: com
|
||||
// 4.b case 2
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_object, obj_base, base);
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_base);
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, obj_base);
|
||||
JERRY_ASSERT (obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
ecma_op_object_get (ret_value, obj_p, ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
@@ -131,12 +142,13 @@ ecma_op_get_value_object_base (ecma_completion_value_t &ret_value, /**< out: com
|
||||
*/
|
||||
void
|
||||
ecma_op_put_value_lex_env_base (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *ref_base_lex_env_p, /**< reference's base (lexical environment) */
|
||||
const ecma_object_ptr_t& ref_base_lex_env_p, /**< reference's base
|
||||
* (lexical environment) */
|
||||
ecma_string_t *var_name_string_p, /**< variable name */
|
||||
bool is_strict, /**< flag indicating strict mode */
|
||||
const ecma_value_t& value) /**< ECMA-value */
|
||||
{
|
||||
const bool is_unresolvable_reference = (ref_base_lex_env_p == NULL);
|
||||
const bool is_unresolvable_reference = (ref_base_lex_env_p.is_null ());
|
||||
|
||||
// 3.
|
||||
if (unlikely (is_unresolvable_reference))
|
||||
@@ -144,13 +156,16 @@ ecma_op_put_value_lex_env_base (ecma_completion_value_t &ret_value, /**< out: co
|
||||
// 3.a.
|
||||
if (is_strict)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_REFERENCE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 3.b.
|
||||
ecma_object_t *global_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL);
|
||||
ecma_object_ptr_t global_object_p;
|
||||
ecma_builtin_get (global_object_p, ECMA_BUILTIN_ID_GLOBAL);
|
||||
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_object_put (completion,
|
||||
@@ -170,7 +185,7 @@ ecma_op_put_value_lex_env_base (ecma_completion_value_t &ret_value, /**< out: co
|
||||
}
|
||||
|
||||
// 5.
|
||||
JERRY_ASSERT(ref_base_lex_env_p != NULL
|
||||
JERRY_ASSERT(ref_base_lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (ref_base_lex_env_p));
|
||||
|
||||
// 5.a
|
||||
@@ -193,7 +208,9 @@ ecma_reject_put (ecma_completion_value_t &ret_value, /**< out: completion value
|
||||
{
|
||||
if (is_throw)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -219,8 +236,14 @@ ecma_op_put_value_object_base (ecma_completion_value_t &ret_value, /**< out: com
|
||||
const bool has_primitive_base = (ecma_is_value_boolean (base)
|
||||
|| ecma_is_value_number (base)
|
||||
|| ecma_is_value_string (base));
|
||||
const bool has_object_base = (ecma_is_value_object (base)
|
||||
&& !(ecma_is_lexical_environment (ecma_get_object_from_value (base))));
|
||||
bool has_object_base = false;
|
||||
if (ecma_is_value_object (base))
|
||||
{
|
||||
ecma_object_ptr_t base_obj_p;
|
||||
ecma_get_object_from_value (base_obj_p, base);
|
||||
|
||||
has_object_base = !ecma_is_lexical_environment (base_obj_p);
|
||||
}
|
||||
const bool is_property_reference = has_primitive_base || has_object_base;
|
||||
|
||||
JERRY_ASSERT (!is_unresolvable_reference);
|
||||
@@ -231,8 +254,9 @@ ecma_op_put_value_object_base (ecma_completion_value_t &ret_value, /**< out: com
|
||||
{
|
||||
// 4.b case 1
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (base);
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, base);
|
||||
JERRY_ASSERT (obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_object_put, put_ret_value, obj_p,
|
||||
@@ -251,8 +275,9 @@ ecma_op_put_value_object_base (ecma_completion_value_t &ret_value, /**< out: com
|
||||
// sub_1.
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_to_object, obj_base, base);
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_base);
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_get_object_from_value (obj_p, obj_base);
|
||||
JERRY_ASSERT (obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
ecma_string_t *referenced_name_p = ECMA_GET_NON_NULL_POINTER (ecma_string_t,
|
||||
@@ -284,9 +309,9 @@ ecma_op_put_value_object_base (ecma_completion_value_t &ret_value, /**< out: com
|
||||
// sub_6.
|
||||
JERRY_ASSERT (prop_p != NULL && prop_p->type == ECMA_PROPERTY_NAMEDACCESSOR);
|
||||
|
||||
ecma_object_t *setter_p = ECMA_GET_NON_NULL_POINTER(ecma_object_t,
|
||||
prop_p->u.named_accessor_property.set_p);
|
||||
JERRY_ASSERT (setter_p != NULL);
|
||||
ecma_object_ptr_t setter_p;
|
||||
setter_p.unpack_from (prop_p->u.named_accessor_property.set_p);
|
||||
JERRY_ASSERT (setter_p.is_not_null ());
|
||||
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_function_call, call_ret, setter_p, base, &value, 1);
|
||||
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
* @return true / false
|
||||
*/
|
||||
bool
|
||||
ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
ecma_op_has_binding (const ecma_object_ptr_t& lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p) /**< argument N */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
|
||||
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
|
||||
@@ -55,7 +55,8 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_object_ptr_t binding_obj_p;
|
||||
ecma_get_lex_env_binding_object (binding_obj_p, lex_env_p);
|
||||
|
||||
return (ecma_op_object_get_property (binding_obj_p, name_p) != NULL);
|
||||
}
|
||||
@@ -71,11 +72,11 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
*/
|
||||
void
|
||||
ecma_op_create_mutable_binding (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_object_ptr_t& lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p, /**< argument N */
|
||||
bool is_deletable) /**< argument D */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
|
||||
@@ -89,7 +90,8 @@ ecma_op_create_mutable_binding (ecma_completion_value_t &ret_value, /**< out: co
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_object_ptr_t binding_obj_p;
|
||||
ecma_get_lex_env_binding_object (binding_obj_p, lex_env_p);
|
||||
|
||||
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
|
||||
{
|
||||
@@ -138,12 +140,12 @@ ecma_op_create_mutable_binding (ecma_completion_value_t &ret_value, /**< out: co
|
||||
*/
|
||||
void
|
||||
ecma_op_set_mutable_binding (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_object_ptr_t& lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p, /**< argument N */
|
||||
const ecma_value_t& value, /**< argument V */
|
||||
bool is_strict) /**< argument S */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
|
||||
@@ -164,7 +166,9 @@ ecma_op_set_mutable_binding (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
|
||||
if (is_equal)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
ecma_object_ptr_t cp_error_obj_p;
|
||||
ecma_builtin_get (cp_error_obj_p, ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR);
|
||||
ecma_make_throw_obj_completion_value (ret_value, cp_error_obj_p);
|
||||
return;
|
||||
}
|
||||
# endif /* CONFIG_ECMA_COMPACT_PROFILE */
|
||||
@@ -178,7 +182,9 @@ ecma_op_set_mutable_binding (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
}
|
||||
else if (is_strict)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -186,7 +192,8 @@ ecma_op_set_mutable_binding (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_object_ptr_t binding_obj_p;
|
||||
ecma_get_lex_env_binding_object (binding_obj_p, lex_env_p);
|
||||
|
||||
ecma_completion_value_t completion;
|
||||
ecma_op_object_put (completion,
|
||||
@@ -220,11 +227,11 @@ ecma_op_set_mutable_binding (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
*/
|
||||
void
|
||||
ecma_op_get_binding_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_object_ptr_t& lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p, /**< argument N */
|
||||
bool is_strict) /**< argument S */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
|
||||
@@ -245,7 +252,9 @@ ecma_op_get_binding_value (ecma_completion_value_t &ret_value, /**< out: complet
|
||||
|
||||
if (is_equal)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_builtin_get (ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR));
|
||||
ecma_object_ptr_t cp_error_obj_p;
|
||||
ecma_builtin_get (cp_error_obj_p, ECMA_BUILTIN_ID_COMPACT_PROFILE_ERROR);
|
||||
ecma_make_throw_obj_completion_value (ret_value, cp_error_obj_p);
|
||||
return;
|
||||
}
|
||||
# endif /* CONFIG_ECMA_COMPACT_PROFILE */
|
||||
@@ -263,7 +272,9 @@ ecma_op_get_binding_value (ecma_completion_value_t &ret_value, /**< out: complet
|
||||
/* unitialized immutable binding */
|
||||
if (is_strict)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_REFERENCE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -282,13 +293,16 @@ ecma_op_get_binding_value (ecma_completion_value_t &ret_value, /**< out: complet
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_object_ptr_t binding_obj_p;
|
||||
ecma_get_lex_env_binding_object (binding_obj_p, lex_env_p);
|
||||
|
||||
if (ecma_op_object_get_property (binding_obj_p, name_p) == NULL)
|
||||
{
|
||||
if (is_strict)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_REFERENCE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -313,10 +327,10 @@ ecma_op_get_binding_value (ecma_completion_value_t &ret_value, /**< out: complet
|
||||
*/
|
||||
void
|
||||
ecma_op_delete_binding (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_object_ptr_t& lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p) /**< argument N */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
|
||||
@@ -352,7 +366,8 @@ ecma_op_delete_binding (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_object_ptr_t binding_obj_p;
|
||||
ecma_get_lex_env_binding_object (binding_obj_p, lex_env_p);
|
||||
|
||||
ecma_op_object_delete (ret_value, binding_obj_p, name_p, false);
|
||||
}
|
||||
@@ -368,9 +383,9 @@ ecma_op_delete_binding (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
*/
|
||||
void
|
||||
ecma_op_implicit_this_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *lex_env_p) /**< lexical environment */
|
||||
const ecma_object_ptr_t& lex_env_p) /**< lexical environment */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
|
||||
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
|
||||
@@ -383,7 +398,8 @@ ecma_op_implicit_this_value (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
|
||||
if (ecma_get_lex_env_provide_this (lex_env_p))
|
||||
{
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_object_ptr_t binding_obj_p;
|
||||
ecma_get_lex_env_binding_object (binding_obj_p, lex_env_p);
|
||||
ecma_ref_object (binding_obj_p);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (binding_obj_p));
|
||||
@@ -401,10 +417,10 @@ ecma_op_implicit_this_value (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
* See also: ECMA-262 v5, 10.2.1
|
||||
*/
|
||||
void
|
||||
ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
ecma_op_create_immutable_binding (const ecma_object_ptr_t& lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p) /**< argument N */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
|
||||
|
||||
@@ -433,11 +449,11 @@ ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environ
|
||||
* See also: ECMA-262 v5, 10.2.1
|
||||
*/
|
||||
void
|
||||
ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
ecma_op_initialize_immutable_binding (const ecma_object_ptr_t& lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p, /**< argument N */
|
||||
const ecma_value_t& value) /**< argument V */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
|
||||
|
||||
@@ -460,17 +476,18 @@ ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, /**< lexical env
|
||||
*
|
||||
* @return pointer to created lexical environment
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_op_create_global_environment (ecma_object_t *glob_obj_p) /**< the Global object */
|
||||
void
|
||||
ecma_op_create_global_environment (ecma_object_ptr_t &glob_env_p, /**< out: object pointer */
|
||||
const ecma_object_ptr_t& glob_obj_p) /**< the Global object */
|
||||
{
|
||||
ecma_object_ptr_t null_pointer;
|
||||
|
||||
#ifdef CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE
|
||||
(void) glob_obj_p;
|
||||
ecma_object_t *glob_env_p = ecma_create_decl_lex_env (NULL);
|
||||
ecma_create_decl_lex_env (glob_env_p, null_pointer);
|
||||
#else /* !CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE */
|
||||
ecma_object_t *glob_env_p = ecma_create_object_lex_env (NULL, glob_obj_p, false);
|
||||
ecma_create_object_lex_env (glob_env_p, null_pointer, glob_obj_p, false);
|
||||
#endif /* !CONFIG_ECMA_GLOBAL_ENVIRONMENT_DECLARATIVE */
|
||||
|
||||
return glob_env_p;
|
||||
} /* ecma_op_create_global_environment */
|
||||
|
||||
/**
|
||||
@@ -480,16 +497,17 @@ ecma_op_create_global_environment (ecma_object_t *glob_obj_p) /**< the Global ob
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
ecma_is_lexical_environment_global (ecma_object_t *lex_env_p) /**< lexical environment */
|
||||
ecma_is_lexical_environment_global (const ecma_object_ptr_t& lex_env_p) /**< lexical environment */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
|
||||
ecma_lexical_environment_type_t type = ecma_get_lex_env_type (lex_env_p);
|
||||
|
||||
if (type == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND)
|
||||
{
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_object_ptr_t binding_obj_p;
|
||||
ecma_get_lex_env_binding_object (binding_obj_p, lex_env_p);
|
||||
|
||||
return ecma_builtin_is (binding_obj_p, ECMA_BUILTIN_ID_GLOBAL);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
/* ECMA-262 v5, 8.7.1 and 8.7.2 */
|
||||
extern void
|
||||
ecma_op_get_value_lex_env_base (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *ref_base_lex_env_p,
|
||||
const ecma_object_ptr_t& ref_base_lex_env_p,
|
||||
ecma_string_t *var_name_string_p,
|
||||
bool is_strict);
|
||||
extern void
|
||||
@@ -41,7 +41,7 @@ ecma_op_get_value_object_base (ecma_completion_value_t &ret_value,
|
||||
const ecma_reference_t& ref);
|
||||
extern void
|
||||
ecma_op_put_value_lex_env_base (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *ref_base_lex_env_p,
|
||||
const ecma_object_ptr_t& ref_base_lex_env_p,
|
||||
ecma_string_t *var_name_string_p,
|
||||
bool is_strict,
|
||||
const ecma_value_t& value);
|
||||
@@ -51,41 +51,41 @@ ecma_op_put_value_object_base (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value);
|
||||
|
||||
/* ECMA-262 v5, Table 17. Abstract methods of Environment Records */
|
||||
extern bool ecma_op_has_binding (ecma_object_t *lex_env_p,
|
||||
extern bool ecma_op_has_binding (const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *name_p);
|
||||
extern void
|
||||
ecma_op_create_mutable_binding (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
bool is_deletable);
|
||||
extern void
|
||||
ecma_op_set_mutable_binding (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
const ecma_value_t& value,
|
||||
bool is_strict);
|
||||
extern void
|
||||
ecma_op_get_binding_value (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
bool is_strict);
|
||||
extern void
|
||||
ecma_op_delete_binding (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p,
|
||||
const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *name_p);
|
||||
extern void
|
||||
ecma_op_implicit_this_value (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *lex_env_p);
|
||||
const ecma_object_ptr_t& lex_env_p);
|
||||
|
||||
/* ECMA-262 v5, Table 18. Additional methods of Declarative Environment Records */
|
||||
extern void ecma_op_create_immutable_binding (ecma_object_t *lex_env_p,
|
||||
extern void ecma_op_create_immutable_binding (const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *name_p);
|
||||
extern void ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p,
|
||||
extern void ecma_op_initialize_immutable_binding (const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
const ecma_value_t& value);
|
||||
|
||||
extern ecma_object_t* ecma_op_create_global_environment (ecma_object_t *glob_obj_p);
|
||||
extern bool ecma_is_lexical_environment_global (ecma_object_t *lex_env_p);
|
||||
extern void ecma_op_create_global_environment (ecma_object_ptr_t &ret_val, const ecma_object_ptr_t& glob_obj_p);
|
||||
extern bool ecma_is_lexical_environment_global (const ecma_object_ptr_t& lex_env_p);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -57,14 +57,15 @@ ecma_op_create_number_object (ecma_completion_value_t &ret_value, /**< out: comp
|
||||
ecma_number_t *prim_value_p = ecma_get_number_from_value (num_value);
|
||||
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, ECMA_BUILTIN_ID_NUMBER_PROTOTYPE);
|
||||
#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_NUMBER_BUILTIN */
|
||||
|
||||
ecma_object_t *obj_p = ecma_create_object (prototype_obj_p,
|
||||
true,
|
||||
ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_create_object (obj_p, prototype_obj_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
|
||||
@@ -40,9 +40,10 @@
|
||||
*
|
||||
* @return pointer to newly created Arguments object
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment the Arguments
|
||||
void
|
||||
ecma_create_arguments_object (ecma_object_ptr_t &obj_p, /**< out: object pointer */
|
||||
const ecma_object_ptr_t& func_obj_p, /**< callee function */
|
||||
const ecma_object_ptr_t& lex_env_p, /**< lexical environment the Arguments
|
||||
object is created for */
|
||||
ecma_collection_iterator_t *formal_params_iter_p, /**< formal parameters
|
||||
collection iterator */
|
||||
@@ -55,9 +56,10 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
*len_p = ecma_uint32_to_number (arguments_list_length);
|
||||
|
||||
// 2., 3., 6.
|
||||
ecma_object_t *prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
ecma_object_ptr_t prototype_p;
|
||||
ecma_builtin_get (prototype_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
|
||||
ecma_object_t *obj_p = ecma_create_object (prototype_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_create_object (obj_p, prototype_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
|
||||
ecma_deref_object (prototype_p);
|
||||
|
||||
@@ -130,7 +132,8 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
&& formal_params_number > 0)
|
||||
{
|
||||
// 8.
|
||||
ecma_object_t *map_p = ecma_op_create_object_object_noarg ();
|
||||
ecma_object_ptr_t map_p;
|
||||
ecma_op_create_object_object_noarg (map_p);
|
||||
|
||||
// 11.c
|
||||
MEM_DEFINE_LOCAL_ARRAY (formal_params, formal_params_number, ecma_string_t *);
|
||||
@@ -197,12 +200,18 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
|
||||
ecma_property_t *parameters_map_prop_p = ecma_create_internal_property (obj_p,
|
||||
ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP);
|
||||
ECMA_SET_POINTER(parameters_map_prop_p->u.internal_property.value, map_p);
|
||||
{
|
||||
ecma_object_t *map_tmp_p = (ecma_object_t*) map_p;
|
||||
ECMA_SET_POINTER(parameters_map_prop_p->u.internal_property.value, map_tmp_p);
|
||||
}
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, map_p);
|
||||
|
||||
ecma_property_t *scope_prop_p = ecma_create_internal_property (map_p,
|
||||
ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
ECMA_SET_POINTER(scope_prop_p->u.internal_property.value, lex_env_p);
|
||||
{
|
||||
ecma_object_t *lex_env_tmp_p = (ecma_object_t *) lex_env_p;
|
||||
ECMA_SET_POINTER(scope_prop_p->u.internal_property.value, lex_env_tmp_p);
|
||||
}
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (map_p, lex_env_p);
|
||||
|
||||
ecma_deref_object (map_p);
|
||||
@@ -239,16 +248,17 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_object_t *thrower_p = ecma_builtin_get (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
|
||||
ecma_object_ptr_t thrower_p;
|
||||
ecma_builtin_get (thrower_p, ECMA_BUILTIN_ID_TYPE_ERROR_THROWER);
|
||||
|
||||
// 14.
|
||||
prop_desc = ecma_make_empty_property_descriptor ();
|
||||
{
|
||||
prop_desc.is_get_defined = true;
|
||||
prop_desc.get_p = thrower_p;
|
||||
prop_desc.get_p = (ecma_object_t*) thrower_p;
|
||||
|
||||
prop_desc.is_set_defined = true;
|
||||
prop_desc.set_p = thrower_p;
|
||||
prop_desc.set_p = (ecma_object_t*) thrower_p;
|
||||
|
||||
prop_desc.is_enumerable_defined = true;
|
||||
prop_desc.is_enumerable = false;
|
||||
@@ -271,8 +281,6 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
ecma_deref_ecma_string (caller_magic_string_p);
|
||||
ecma_deref_object (thrower_p);
|
||||
}
|
||||
|
||||
return obj_p;
|
||||
} /* ecma_create_arguments_object */
|
||||
|
||||
/**
|
||||
@@ -283,15 +291,15 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p, /**< callee function */
|
||||
*/
|
||||
static void
|
||||
ecma_arguments_get_mapped_arg_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *map_p, /**< [[ParametersMap]] object */
|
||||
const ecma_object_ptr_t& map_p, /**< [[ParametersMap]] object */
|
||||
ecma_property_t *arg_name_prop_p) /**< property of [[ParametersMap]]
|
||||
corresponding to index and value
|
||||
equal to mapped argument's name */
|
||||
{
|
||||
ecma_property_t *scope_prop_p = ecma_get_internal_property (map_p, ECMA_INTERNAL_PROPERTY_SCOPE);
|
||||
ecma_object_t *lex_env_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
scope_prop_p->u.internal_property.value);
|
||||
JERRY_ASSERT(lex_env_p != NULL
|
||||
ecma_object_ptr_t lex_env_p;
|
||||
lex_env_p.unpack_from (scope_prop_p->u.internal_property.value);
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ()
|
||||
&& ecma_is_lexical_environment (lex_env_p));
|
||||
|
||||
ecma_value_t arg_name_prop_value;
|
||||
@@ -315,13 +323,13 @@ ecma_arguments_get_mapped_arg_value (ecma_completion_value_t &ret_value, /**< ou
|
||||
*/
|
||||
void
|
||||
ecma_op_arguments_object_get (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
// 1.
|
||||
ecma_property_t *map_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP);
|
||||
ecma_object_t *map_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
map_prop_p->u.internal_property.value);
|
||||
ecma_object_ptr_t map_p;
|
||||
map_p.unpack_from (map_prop_p->u.internal_property.value);
|
||||
|
||||
// 2.
|
||||
ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p);
|
||||
@@ -352,7 +360,7 @@ ecma_op_arguments_object_get (ecma_completion_value_t &ret_value, /**< out: comp
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_op_arguments_object_get_own_property (const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
// 1.
|
||||
@@ -366,8 +374,8 @@ ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p, /**< the object
|
||||
|
||||
// 3.
|
||||
ecma_property_t *map_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP);
|
||||
ecma_object_t *map_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
map_prop_p->u.internal_property.value);
|
||||
ecma_object_ptr_t map_p;
|
||||
map_p.unpack_from (map_prop_p->u.internal_property.value);
|
||||
|
||||
// 4.
|
||||
ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p);
|
||||
@@ -403,7 +411,7 @@ ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p, /**< the object
|
||||
*/
|
||||
void
|
||||
ecma_op_arguments_object_define_own_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_property_descriptor_t* property_desc_p, /**< property
|
||||
* descriptor */
|
||||
@@ -411,8 +419,8 @@ ecma_op_arguments_object_define_own_property (ecma_completion_value_t &ret_value
|
||||
{
|
||||
// 1.
|
||||
ecma_property_t *map_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP);
|
||||
ecma_object_t *map_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
map_prop_p->u.internal_property.value);
|
||||
ecma_object_ptr_t map_p;
|
||||
map_p.unpack_from (map_prop_p->u.internal_property.value);
|
||||
|
||||
// 2.
|
||||
ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p);
|
||||
@@ -494,14 +502,14 @@ ecma_op_arguments_object_define_own_property (ecma_completion_value_t &ret_value
|
||||
*/
|
||||
void
|
||||
ecma_op_arguments_object_delete (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
// 1.
|
||||
ecma_property_t *map_prop_p = ecma_get_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_PARAMETERS_MAP);
|
||||
ecma_object_t *map_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
map_prop_p->u.internal_property.value);
|
||||
ecma_object_ptr_t map_p;
|
||||
map_p.unpack_from (map_prop_p->u.internal_property.value);
|
||||
|
||||
// 2.
|
||||
ecma_property_t *mapped_prop_p = ecma_op_object_get_own_property (map_p, property_name_p);
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-value.h"
|
||||
|
||||
extern ecma_object_t*
|
||||
ecma_create_arguments_object (ecma_object_t *func_obj_p,
|
||||
ecma_object_t *lex_env_p,
|
||||
extern void
|
||||
ecma_create_arguments_object (ecma_object_ptr_t &ret_val,
|
||||
const ecma_object_ptr_t& func_obj_p,
|
||||
const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_collection_iterator_t *formal_params_iter_p,
|
||||
const ecma_value_t *arguments_list_p,
|
||||
ecma_length_t arguments_list_length,
|
||||
@@ -30,19 +31,19 @@ ecma_create_arguments_object (ecma_object_t *func_obj_p,
|
||||
|
||||
extern void
|
||||
ecma_op_arguments_object_get (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p,
|
||||
ecma_op_arguments_object_get_own_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_arguments_object_delete (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
extern void
|
||||
ecma_op_arguments_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_property_descriptor_t* property_desc_p,
|
||||
bool is_throw);
|
||||
|
||||
@@ -42,7 +42,9 @@ ecma_reject (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
{
|
||||
if (is_throw)
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -57,20 +59,19 @@ ecma_reject (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
*
|
||||
* @return pointer to newly created 'Object' object
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_op_create_object_object_noarg (void)
|
||||
void
|
||||
ecma_op_create_object_object_noarg (ecma_object_ptr_t &obj_p) /**< out: object pointer */
|
||||
{
|
||||
ecma_object_t *object_prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
ecma_object_ptr_t object_prototype_p;
|
||||
ecma_builtin_get (object_prototype_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
|
||||
// 3., 4., 6., 7.
|
||||
ecma_object_t *obj_p = ecma_create_object (object_prototype_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_create_object (obj_p, object_prototype_p, true, ECMA_OBJECT_TYPE_GENERAL);
|
||||
|
||||
ecma_deref_object (object_prototype_p);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
class_prop_p->u.internal_property.value = ECMA_MAGIC_STRING_OBJECT_UL;
|
||||
|
||||
return obj_p;
|
||||
} /* ecma_op_create_object_object_noarg */
|
||||
|
||||
/**
|
||||
@@ -100,7 +101,8 @@ ecma_op_create_object_object_arg (ecma_completion_value_t &ret_value, /**< out:
|
||||
JERRY_ASSERT (ecma_is_value_undefined (value)
|
||||
|| ecma_is_value_null (value));
|
||||
|
||||
ecma_object_t *obj_p = ecma_op_create_object_object_noarg ();
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_op_create_object_object_noarg (obj_p);
|
||||
|
||||
ecma_make_normal_completion_value (ret_value, ecma_value_t (obj_p));
|
||||
}
|
||||
@@ -118,10 +120,10 @@ ecma_op_create_object_object_arg (ecma_completion_value_t &ret_value, /**< out:
|
||||
*/
|
||||
void
|
||||
ecma_op_general_object_get (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -149,11 +151,11 @@ ecma_op_general_object_get (ecma_completion_value_t &ret_value, /**< out: comple
|
||||
else
|
||||
{
|
||||
// 4.
|
||||
ecma_object_t *getter_p = ECMA_GET_POINTER (ecma_object_t,
|
||||
prop_p->u.named_accessor_property.get_p);
|
||||
ecma_object_ptr_t getter_p;
|
||||
getter_p.unpack_from (prop_p->u.named_accessor_property.get_p, true);
|
||||
|
||||
// 5.
|
||||
if (getter_p == NULL)
|
||||
if (getter_p.is_null ())
|
||||
{
|
||||
ecma_make_simple_completion_value (ret_value, ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
@@ -179,10 +181,10 @@ ecma_op_general_object_get (ecma_completion_value_t &ret_value, /**< out: comple
|
||||
* NULL (i.e. ecma-undefined) - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_op_general_object_get_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_op_general_object_get_own_property (const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -200,10 +202,10 @@ ecma_op_general_object_get_own_property (ecma_object_t *obj_p, /**< the object *
|
||||
* NULL (i.e. ecma-undefined) - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_op_general_object_get_property (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_op_general_object_get_property (const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -217,10 +219,11 @@ ecma_op_general_object_get_property (ecma_object_t *obj_p, /**< the object */
|
||||
}
|
||||
|
||||
// 3.
|
||||
ecma_object_t *prototype_p = ecma_get_object_prototype (obj_p);
|
||||
ecma_object_ptr_t prototype_p;
|
||||
ecma_get_object_prototype (prototype_p, obj_p);
|
||||
|
||||
// 4., 5.
|
||||
if (prototype_p != NULL)
|
||||
if (prototype_p.is_not_null ())
|
||||
{
|
||||
return ecma_op_object_get_property (prototype_p, property_name_p);
|
||||
}
|
||||
@@ -242,12 +245,12 @@ ecma_op_general_object_get_property (ecma_object_t *obj_p, /**< the object */
|
||||
*/
|
||||
void
|
||||
ecma_op_general_object_put (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_value_t& value, /**< ecma-value */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -257,7 +260,9 @@ ecma_op_general_object_put (ecma_completion_value_t &ret_value, /**< out: comple
|
||||
if (is_throw)
|
||||
{
|
||||
// a.
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
else
|
||||
@@ -299,9 +304,9 @@ ecma_op_general_object_put (ecma_completion_value_t &ret_value, /**< out: comple
|
||||
&& desc_p->type == ECMA_PROPERTY_NAMEDACCESSOR)
|
||||
{
|
||||
// a.
|
||||
ecma_object_t *setter_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t,
|
||||
desc_p->u.named_accessor_property.set_p);
|
||||
JERRY_ASSERT(setter_p != NULL);
|
||||
ecma_object_ptr_t setter_p;
|
||||
setter_p.unpack_from (desc_p->u.named_accessor_property.set_p);
|
||||
JERRY_ASSERT(setter_p.is_not_null ());
|
||||
|
||||
ECMA_TRY_CATCH (ret_value, ecma_op_function_call, call_ret, setter_p, ecma_value_t (obj_p), &value, 1);
|
||||
|
||||
@@ -349,10 +354,10 @@ ecma_op_general_object_put (ecma_completion_value_t &ret_value, /**< out: comple
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_op_general_object_can_put (const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -388,10 +393,11 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
}
|
||||
|
||||
// 3.
|
||||
ecma_object_t *proto_p = ecma_get_object_prototype (obj_p);
|
||||
ecma_object_ptr_t proto_p;
|
||||
ecma_get_object_prototype (proto_p, obj_p);
|
||||
|
||||
// 4.
|
||||
if (proto_p == NULL)
|
||||
if (proto_p.is_null ())
|
||||
{
|
||||
return ecma_get_object_extensible (obj_p);
|
||||
}
|
||||
@@ -408,11 +414,11 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
// 7.
|
||||
if (inherited_p->type == ECMA_PROPERTY_NAMEDACCESSOR)
|
||||
{
|
||||
ecma_object_t *setter_p = ECMA_GET_POINTER (ecma_object_t,
|
||||
inherited_p->u.named_accessor_property.set_p);
|
||||
ecma_object_ptr_t setter_p;
|
||||
setter_p.unpack_from (inherited_p->u.named_accessor_property.set_p, true);
|
||||
|
||||
// a.
|
||||
if (setter_p == NULL)
|
||||
if (setter_p.is_null ())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -452,11 +458,11 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
*/
|
||||
void
|
||||
ecma_op_general_object_delete (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -482,7 +488,9 @@ ecma_op_general_object_delete (ecma_completion_value_t &ret_value, /**< out: com
|
||||
else if (is_throw)
|
||||
{
|
||||
// 4.
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -503,10 +511,10 @@ ecma_op_general_object_delete (ecma_completion_value_t &ret_value, /**< out: com
|
||||
*/
|
||||
void
|
||||
ecma_op_general_object_default_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_preferred_type_hint_t hint) /**< hint on preferred result type */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
if (hint == ECMA_PREFERRED_TYPE_NO)
|
||||
@@ -559,7 +567,8 @@ ecma_op_general_object_default_value (ecma_completion_value_t &ret_value, /**< o
|
||||
|
||||
if (ecma_op_is_callable (function_value_get))
|
||||
{
|
||||
ecma_object_t *func_obj_p = ecma_get_object_from_value (function_value_get);
|
||||
ecma_object_ptr_t func_obj_p;
|
||||
ecma_get_object_from_value (func_obj_p, function_value_get);
|
||||
|
||||
ecma_op_function_call (call_completion,
|
||||
func_obj_p,
|
||||
@@ -590,7 +599,9 @@ ecma_op_general_object_default_value (ecma_completion_value_t &ret_value, /**< o
|
||||
ecma_free_completion_value (call_completion);
|
||||
}
|
||||
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
} /* ecma_op_general_object_default_value */
|
||||
|
||||
/**
|
||||
@@ -605,13 +616,13 @@ ecma_op_general_object_default_value (ecma_completion_value_t &ret_value, /**< o
|
||||
*/
|
||||
void
|
||||
ecma_op_general_object_define_own_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_property_descriptor_t* property_desc_p, /**< property
|
||||
* descriptor */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -658,10 +669,15 @@ ecma_op_general_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
// b.
|
||||
JERRY_ASSERT(is_property_desc_accessor_descriptor);
|
||||
|
||||
ecma_object_ptr_t get_p, set_p;
|
||||
|
||||
get_p = property_desc_p->get_p;
|
||||
set_p = property_desc_p->set_p;
|
||||
|
||||
ecma_create_named_accessor_property (obj_p,
|
||||
property_name_p,
|
||||
property_desc_p->get_p,
|
||||
property_desc_p->set_p,
|
||||
get_p,
|
||||
set_p,
|
||||
property_desc_p->is_enumerable,
|
||||
property_desc_p->is_configurable);
|
||||
|
||||
@@ -784,11 +800,12 @@ ecma_op_general_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
if (is_current_data_descriptor)
|
||||
{
|
||||
// b.
|
||||
ecma_object_ptr_t null_pointer;
|
||||
|
||||
current_p = ecma_create_named_accessor_property (obj_p,
|
||||
property_name_p,
|
||||
NULL,
|
||||
NULL,
|
||||
null_pointer,
|
||||
null_pointer,
|
||||
ecma_is_property_enumerable (current_p),
|
||||
ecma_is_property_configurable (current_p));
|
||||
}
|
||||
@@ -875,9 +892,13 @@ ecma_op_general_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
{
|
||||
JERRY_ASSERT(is_current_accessor_descriptor);
|
||||
|
||||
ecma_object_t *get_p = property_desc_p->get_p;
|
||||
ecma_object_ptr_t get_p;
|
||||
get_p = property_desc_p->get_p;
|
||||
|
||||
ECMA_SET_POINTER(current_p->u.named_accessor_property.get_p, get_p);
|
||||
{
|
||||
ecma_object_t *get_tmp_p = (ecma_object_t*) get_p;
|
||||
ECMA_SET_POINTER(current_p->u.named_accessor_property.get_p, get_tmp_p);
|
||||
}
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, get_p);
|
||||
}
|
||||
|
||||
@@ -885,9 +906,13 @@ ecma_op_general_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
{
|
||||
JERRY_ASSERT(is_current_accessor_descriptor);
|
||||
|
||||
ecma_object_t *set_p = property_desc_p->set_p;
|
||||
ecma_object_ptr_t set_p;
|
||||
set_p = property_desc_p->set_p;
|
||||
|
||||
ECMA_SET_POINTER(current_p->u.named_accessor_property.set_p, set_p);
|
||||
{
|
||||
ecma_object_t *set_tmp_p = (ecma_object_t*) set_p;
|
||||
ECMA_SET_POINTER(current_p->u.named_accessor_property.set_p, set_tmp_p);
|
||||
}
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, set_p);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,43 +27,43 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
extern ecma_object_t*
|
||||
ecma_op_create_object_object_noarg (void);
|
||||
extern void
|
||||
ecma_op_create_object_object_noarg (ecma_object_ptr_t &ret_val);
|
||||
extern void
|
||||
ecma_op_create_object_object_arg (ecma_completion_value_t &ret_value,
|
||||
const ecma_value_t& value);
|
||||
|
||||
extern void
|
||||
ecma_op_general_object_get (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_general_object_get_own_property (ecma_object_t *obj_p,
|
||||
ecma_op_general_object_get_own_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_general_object_get_property (ecma_object_t *obj_p,
|
||||
ecma_op_general_object_get_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_general_object_put (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_value_t& value,
|
||||
bool is_throw);
|
||||
extern bool
|
||||
ecma_op_general_object_can_put (ecma_object_t *obj_p,
|
||||
ecma_op_general_object_can_put (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_general_object_delete (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
extern void
|
||||
ecma_op_general_object_default_value (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_preferred_type_hint_t hint);
|
||||
extern void
|
||||
ecma_op_general_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_property_descriptor_t* property_desc_p,
|
||||
bool is_throw);
|
||||
|
||||
@@ -42,10 +42,10 @@
|
||||
*/
|
||||
void
|
||||
ecma_op_object_get (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -87,7 +87,7 @@ ecma_op_object_get (ecma_completion_value_t &ret_value, /**< out: completion val
|
||||
* NULL (i.e. ecma-undefined) - otherwise.
|
||||
*/
|
||||
static __noinline ecma_property_t*
|
||||
ecma_op_object_get_own_property_longpath (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_op_object_get_own_property_longpath (const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
const ecma_object_type_t type = ecma_get_object_type (obj_p);
|
||||
@@ -154,10 +154,10 @@ ecma_op_object_get_own_property_longpath (ecma_object_t *obj_p, /**< the object
|
||||
* NULL (i.e. ecma-undefined) - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_op_object_get_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_op_object_get_own_property (const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -183,10 +183,10 @@ ecma_op_object_get_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
* NULL (i.e. ecma-undefined) - otherwise.
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_op_object_get_property (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_op_object_get_property (const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -194,7 +194,7 @@ ecma_op_object_get_property (ecma_object_t *obj_p, /**< the object */
|
||||
JERRY_ASSERT (type < ECMA_OBJECT_TYPE__COUNT);
|
||||
|
||||
/*
|
||||
* typedef ecma_property_t* (*get_property_ptr_t) (ecma_object_t *, ecma_string_t *);
|
||||
* typedef ecma_property_t* (*get_property_ptr_t) (const ecma_object_ptr_t& , ecma_string_t *);
|
||||
* static const get_property_ptr_t get_property [ECMA_OBJECT_TYPE__COUNT] =
|
||||
* {
|
||||
* [ECMA_OBJECT_TYPE_GENERAL] = &ecma_op_general_object_get_property,
|
||||
@@ -223,12 +223,12 @@ ecma_op_object_get_property (ecma_object_t *obj_p, /**< the object */
|
||||
*/
|
||||
void
|
||||
ecma_op_object_put (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_value_t& value, /**< ecma-value */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -236,7 +236,7 @@ ecma_op_object_put (ecma_completion_value_t &ret_value, /**< out: completion val
|
||||
JERRY_ASSERT (type < ECMA_OBJECT_TYPE__COUNT);
|
||||
|
||||
/*
|
||||
* typedef ecma_property_t* (*put_ptr_t) (ecma_object_t *, ecma_string_t *);
|
||||
* typedef ecma_property_t* (*put_ptr_t) (const ecma_object_ptr_t& , ecma_string_t *);
|
||||
* static const put_ptr_t put [ECMA_OBJECT_TYPE__COUNT] =
|
||||
* {
|
||||
* [ECMA_OBJECT_TYPE_GENERAL] = &ecma_op_general_object_put,
|
||||
@@ -264,10 +264,10 @@ ecma_op_object_put (ecma_completion_value_t &ret_value, /**< out: completion val
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
ecma_op_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_op_object_can_put (const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -275,7 +275,7 @@ ecma_op_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
JERRY_ASSERT (type < ECMA_OBJECT_TYPE__COUNT);
|
||||
|
||||
/*
|
||||
* typedef ecma_property_t* (*can_put_ptr_t) (ecma_object_t *, ecma_string_t *);
|
||||
* typedef ecma_property_t* (*can_put_ptr_t) (const ecma_object_ptr_t& , ecma_string_t *);
|
||||
* static const can_put_ptr_t can_put [ECMA_OBJECT_TYPE__COUNT] =
|
||||
* {
|
||||
* [ECMA_OBJECT_TYPE_GENERAL] = &ecma_op_general_object_can_put,
|
||||
@@ -304,11 +304,11 @@ ecma_op_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
*/
|
||||
void
|
||||
ecma_op_object_delete (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -360,17 +360,17 @@ ecma_op_object_delete (ecma_completion_value_t &ret_value, /**< out: completion
|
||||
*/
|
||||
void
|
||||
ecma_op_object_default_value (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_preferred_type_hint_t hint) /**< hint on preferred result type */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
const ecma_object_type_t type = ecma_get_object_type (obj_p);
|
||||
JERRY_ASSERT (type < ECMA_OBJECT_TYPE__COUNT);
|
||||
|
||||
/*
|
||||
* typedef ecma_property_t* (*default_value_ptr_t) (ecma_object_t *, ecma_string_t *);
|
||||
* typedef ecma_property_t* (*default_value_ptr_t) (const ecma_object_ptr_t& , ecma_string_t *);
|
||||
* static const default_value_ptr_t default_value [ECMA_OBJECT_TYPE__COUNT] =
|
||||
* {
|
||||
* [ECMA_OBJECT_TYPE_GENERAL] = &ecma_op_general_object_default_value,
|
||||
@@ -399,13 +399,13 @@ ecma_op_object_default_value (ecma_completion_value_t &ret_value, /**< out: comp
|
||||
*/
|
||||
void
|
||||
ecma_op_object_define_own_property (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
const ecma_property_descriptor_t* property_desc_p, /**< property
|
||||
* descriptor */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
@@ -465,10 +465,10 @@ ecma_op_object_define_own_property (ecma_completion_value_t &ret_value, /**< out
|
||||
*/
|
||||
void
|
||||
ecma_op_object_has_instance (ecma_completion_value_t &ret_value, /**< out: completion value */
|
||||
ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_object_ptr_t& obj_p, /**< the object */
|
||||
const ecma_value_t& value) /**< argument 'V' */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
JERRY_ASSERT(obj_p.is_not_null ()
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
const ecma_object_type_t type = ecma_get_object_type (obj_p);
|
||||
@@ -480,7 +480,9 @@ ecma_op_object_has_instance (ecma_completion_value_t &ret_value, /**< out: compl
|
||||
case ECMA_OBJECT_TYPE_STRING:
|
||||
case ECMA_OBJECT_TYPE_ARGUMENTS:
|
||||
{
|
||||
ecma_make_throw_obj_completion_value (ret_value, ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
ecma_object_ptr_t exception_obj_p;
|
||||
ecma_new_standard_error (exception_obj_p, ECMA_ERROR_TYPE);
|
||||
ecma_make_throw_obj_completion_value (ret_value, exception_obj_p);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,41 +29,41 @@
|
||||
|
||||
extern void
|
||||
ecma_op_object_get (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_object_get_own_property (ecma_object_t *obj_p,
|
||||
ecma_op_object_get_own_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_property_t*
|
||||
ecma_op_object_get_property (ecma_object_t *obj_p,
|
||||
ecma_op_object_get_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_object_put (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_value_t& value,
|
||||
bool is_throw);
|
||||
extern bool
|
||||
ecma_op_object_can_put (ecma_object_t *obj_p,
|
||||
ecma_op_object_can_put (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern void
|
||||
ecma_op_object_delete (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
extern void
|
||||
ecma_op_object_default_value (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_preferred_type_hint_t hint);
|
||||
extern void
|
||||
ecma_op_object_define_own_property (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
const ecma_property_descriptor_t* property_desc_p,
|
||||
bool is_throw);
|
||||
extern void
|
||||
ecma_op_object_has_instance (ecma_completion_value_t &ret_value,
|
||||
ecma_object_t *obj_p,
|
||||
const ecma_object_ptr_t& obj_p,
|
||||
const ecma_value_t& value);
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -36,25 +36,24 @@
|
||||
* pointer to lexical environment - reference's base,
|
||||
* else - NULL.
|
||||
*/
|
||||
ecma_object_t*
|
||||
ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, /**< starting lexical environment */
|
||||
void
|
||||
ecma_op_resolve_reference_base (ecma_object_ptr_t &lex_env_iter_p, /**< out: object pointer */
|
||||
const ecma_object_ptr_t &lex_env_p, /**< starting lexical environment */
|
||||
ecma_string_t *name_p) /**< identifier's name */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL);
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ());
|
||||
|
||||
ecma_object_t *lex_env_iter_p = lex_env_p;
|
||||
lex_env_iter_p = lex_env_p;
|
||||
|
||||
while (lex_env_iter_p != NULL)
|
||||
while (lex_env_iter_p.is_not_null ())
|
||||
{
|
||||
if (ecma_op_has_binding (lex_env_iter_p, name_p))
|
||||
{
|
||||
return lex_env_iter_p;
|
||||
return;
|
||||
}
|
||||
|
||||
lex_env_iter_p = ecma_get_lex_env_outer_reference (lex_env_iter_p);
|
||||
ecma_get_lex_env_outer_reference (lex_env_iter_p, lex_env_iter_p);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
} /* ecma_op_resolve_reference_base */
|
||||
|
||||
/**
|
||||
@@ -65,15 +64,16 @@ ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, /**< starting lexical
|
||||
*/
|
||||
void
|
||||
ecma_op_get_identifier_reference (ecma_reference_t &ret, /**< out: reference */
|
||||
ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_object_ptr_t& lex_env_p, /**< lexical environment */
|
||||
ecma_string_t *name_p, /**< identifier's name */
|
||||
bool is_strict) /**< strict reference flag */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL);
|
||||
JERRY_ASSERT(lex_env_p.is_not_null ());
|
||||
|
||||
ecma_object_t *base_lex_env_p = ecma_op_resolve_reference_base (lex_env_p, name_p);
|
||||
ecma_object_ptr_t base_lex_env_p;
|
||||
ecma_op_resolve_reference_base (base_lex_env_p, lex_env_p, name_p);
|
||||
|
||||
if (base_lex_env_p != NULL)
|
||||
if (base_lex_env_p.is_not_null ())
|
||||
{
|
||||
ecma_make_reference (ret,
|
||||
ecma_value_t (base_lex_env_p),
|
||||
|
||||
@@ -48,11 +48,13 @@ typedef struct ecma_reference_t
|
||||
unsigned int is_strict : 1;
|
||||
} ecma_reference_t;
|
||||
|
||||
extern ecma_object_t* ecma_op_resolve_reference_base (ecma_object_t *lex_env_p,
|
||||
ecma_string_t *name_p);
|
||||
extern void
|
||||
ecma_op_resolve_reference_base (ecma_object_ptr_t &ret_val,
|
||||
const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *name_p);
|
||||
|
||||
extern void ecma_op_get_identifier_reference (ecma_reference_t &ret,
|
||||
ecma_object_t *lex_env_p,
|
||||
const ecma_object_ptr_t& lex_env_p,
|
||||
ecma_string_t *name_p,
|
||||
bool is_strict);
|
||||
extern void ecma_make_reference (ecma_reference_t &ret,
|
||||
|
||||
@@ -84,14 +84,15 @@ ecma_op_create_string_object (ecma_completion_value_t &ret_value, /**< out: comp
|
||||
}
|
||||
|
||||
#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_STRING_PROTOTYPE);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, ECMA_BUILTIN_ID_STRING_PROTOTYPE);
|
||||
#else /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN */
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
ecma_object_ptr_t prototype_obj_p;
|
||||
ecma_builtin_get (prototype_obj_p, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
|
||||
#endif /* CONFIG_ECMA_COMPACT_PROFILE_DISABLE_STRING_BUILTIN */
|
||||
|
||||
ecma_object_t *obj_p = ecma_create_object (prototype_obj_p,
|
||||
true,
|
||||
ECMA_OBJECT_TYPE_STRING);
|
||||
ecma_object_ptr_t obj_p;
|
||||
ecma_create_object (obj_p, prototype_obj_p, true, ECMA_OBJECT_TYPE_STRING);
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
|
||||
ecma_property_t *class_prop_p = ecma_create_internal_property (obj_p, ECMA_INTERNAL_PROPERTY_CLASS);
|
||||
@@ -125,7 +126,7 @@ ecma_op_create_string_object (ecma_completion_value_t &ret_value, /**< out: comp
|
||||
* Returned value must be freed with ecma_free_completion_value
|
||||
*/
|
||||
ecma_property_t*
|
||||
ecma_op_string_object_get_own_property (ecma_object_t *obj_p, /**< the array object */
|
||||
ecma_op_string_object_get_own_property (const ecma_object_ptr_t& obj_p, /**< the array object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT (ecma_get_object_type (obj_p) == ECMA_OBJECT_TYPE_STRING);
|
||||
|
||||
@@ -32,7 +32,7 @@ ecma_op_create_string_object (ecma_completion_value_t &ret_value,
|
||||
ecma_length_t arguments_list_len);
|
||||
|
||||
extern ecma_property_t*
|
||||
ecma_op_string_object_get_own_property (ecma_object_t *obj_p,
|
||||
ecma_op_string_object_get_own_property (const ecma_object_ptr_t& obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user