diff --git a/src/libecmaobjects/ecma-gc.c b/src/libecmaobjects/ecma-gc.c index 9dacba0da..9367352d5 100644 --- a/src/libecmaobjects/ecma-gc.c +++ b/src/libecmaobjects/ecma-gc.c @@ -514,6 +514,14 @@ ecma_gc_run (ecma_gc_gen_t max_gen_to_collect) /**< maximum generation to run co { ecma_gc_mark (obj_iter_p, max_gen_to_collect); } +#ifndef JERRY_NDEBUG + else + { + ecma_gc_set_object_may_ref_younger_objects (obj_iter_p, true); + ecma_gc_mark (obj_iter_p, max_gen_to_collect); + JERRY_ASSERT (!ecma_gc_is_object_may_ref_younger_objects (obj_iter_p)); + } +#endif /* !JERRY_NDEBUG */ } } diff --git a/src/libecmaobjects/ecma-helpers.c b/src/libecmaobjects/ecma-helpers.c index 611893742..6b5e769d1 100644 --- a/src/libecmaobjects/ecma-helpers.c +++ b/src/libecmaobjects/ecma-helpers.c @@ -160,7 +160,6 @@ ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< out ecma_property_t *binding_object_prop_p = ecma_create_internal_property (new_lexical_environment_p, ECMA_INTERNAL_PROPERTY_BINDING_OBJECT); ECMA_SET_POINTER(binding_object_prop_p->u.internal_property.value, binding_obj_p); - ecma_gc_update_may_ref_younger_object_flag_by_object (new_lexical_environment_p, binding_obj_p); return new_lexical_environment_p; diff --git a/src/libecmaoperations/ecma-function-object.c b/src/libecmaoperations/ecma-function-object.c index d09e9aab7..cfd7a47d9 100644 --- a/src/libecmaoperations/ecma-function-object.c +++ b/src/libecmaoperations/ecma-function-object.c @@ -159,7 +159,6 @@ ecma_op_create_function_object (ecma_string_t* formal_parameter_list_p[], /**< f // 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); // 10., 11. diff --git a/src/libecmaoperations/ecma-lex-env.c b/src/libecmaoperations/ecma-lex-env.c index 2452249ad..3c78f459a 100644 --- a/src/libecmaoperations/ecma-lex-env.c +++ b/src/libecmaoperations/ecma-lex-env.c @@ -200,8 +200,7 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment { ecma_free_value (property_p->u.named_data_property.value, false); property_p->u.named_data_property.value = ecma_copy_value (value, false); - - ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, value); + ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, property_p->u.named_data_property.value); } else if (is_strict) { @@ -476,8 +475,7 @@ ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, /**< lexical env && ecma_is_value_empty (prop_p->u.named_data_property.value)); prop_p->u.named_data_property.value = ecma_copy_value (value, false); - - ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, value); + ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, prop_p->u.named_data_property.value); return; } diff --git a/src/libecmaoperations/ecma-objects-arguments.c b/src/libecmaoperations/ecma-objects-arguments.c index 15c4587b4..9478b47a6 100644 --- a/src/libecmaoperations/ecma-objects-arguments.c +++ b/src/libecmaoperations/ecma-objects-arguments.c @@ -187,10 +187,12 @@ 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_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_gc_update_may_ref_younger_object_flag_by_object (map_p, lex_env_p); ecma_deref_object (map_p); } @@ -364,6 +366,7 @@ ecma_op_arguments_object_get_own_property (ecma_object_t *obj_p, /**< the object ecma_free_value (desc_p->u.named_data_property.value, false); desc_p->u.named_data_property.value = ecma_copy_value (completion.u.value, false); + ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, desc_p->u.named_data_property.value); ecma_free_completion_value (completion); } diff --git a/src/libecmaoperations/ecma-objects-general.c b/src/libecmaoperations/ecma-objects-general.c index 887847311..5cc601937 100644 --- a/src/libecmaoperations/ecma-objects-general.c +++ b/src/libecmaoperations/ecma-objects-general.c @@ -614,8 +614,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec property_desc.configurable); new_prop_p->u.named_data_property.value = ecma_copy_value (property_desc.value, false); - - ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, property_desc.value); + ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, new_prop_p->u.named_data_property.value); } else { @@ -817,8 +816,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec ecma_free_value (current_p->u.named_data_property.value, false); current_p->u.named_data_property.value = ecma_copy_value (property_desc.value, false); - - ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, property_desc.value); + ecma_gc_update_may_ref_younger_object_flag_by_value (obj_p, current_p->u.named_data_property.value); } if (property_desc.is_writable_defined) @@ -833,7 +831,6 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec JERRY_ASSERT(is_current_accessor_descriptor); ECMA_SET_POINTER(current_p->u.named_accessor_property.get_p, property_desc.get_p); - ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, property_desc.get_p); } @@ -842,7 +839,6 @@ ecma_op_general_object_define_own_property (ecma_object_t *obj_p, /**< the objec JERRY_ASSERT(is_current_accessor_descriptor); ECMA_SET_POINTER(current_p->u.named_accessor_property.set_p, property_desc.set_p); - ecma_gc_update_may_ref_younger_object_flag_by_object (obj_p, property_desc.set_p); }