Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing retrieval of [[Class]] properties for built-in function objects, optimizing memory related to [[Class]] property #126

Closed
wants to merge 1 commit into from

Conversation

ruben-ayrapetyan
Copy link
Contributor

@ruben-ayrapetyan ruben-ayrapetyan added bug Undesired behaviour normal ecma core Related to core ECMA functionality ecma builtins Related to ECMA built-in routines labels May 28, 2015
@ruben-ayrapetyan ruben-ayrapetyan added this to the Core ECMA features milestone May 28, 2015
…s, optimizing memory related to [[Class]] property.

 - introduced ecma_object_get_class_name interface;
 - removed creation of [[Class]] internal property for types of objects that unambiguously determine the [[Class]] value.

Related issue: #112

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
@egavrin
Copy link
Contributor

egavrin commented May 29, 2015

Good for me.
@galpeter please check.

ECMA_INTERNAL_PROPERTY_BUILT_IN_ID);
ecma_builtin_id_t builtin_id = (ecma_builtin_id_t) built_in_id_prop_p->u.internal_property.value;

switch (builtin_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it seems that if the Array built-in is disabled (the CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN is defined) then the default case will execute. Am I thinking that correctly, or did I missed something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case the CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN is defined,
the Array built-in is disabled, and ECMA_BUILTIN_ID_ARRAY is not included into ecma_builtin_id_t enum.
So, the routine couldn't be called with ECMA_BUILTIN_ID_ARRAY value in the case (it is checked with assertion in the default case).

jerry-core/ecma/builtin-objects/ecma-builtins.inc.h`

#ifndef CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN
/* The Array.prototype object (15.4.4) */
BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,
         ECMA_OBJECT_TYPE_ARRAY,
         ECMA_MAGIC_STRING_ARRAY_UL,
         ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
         true,
         true,
         array_prototype)

/* The Array object (15.4.1) */
BUILTIN (ECMA_BUILTIN_ID_ARRAY,
         ECMA_OBJECT_TYPE_FUNCTION,
         ECMA_MAGIC_STRING_ARRAY_UL,
         ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
         true,
         true,
         array)
#endif /* !CONFIG_ECMA_COMPACT_PROFILE_DISABLE_ARRAY_BUILTIN*/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah.. I see.

@galpeter
Copy link
Contributor

lgtm

@egavrin
Copy link
Contributor

egavrin commented May 29, 2015

Ok, make push

@ruben-ayrapetyan ruben-ayrapetyan deleted the Ruben-fix-issue-112 branch May 29, 2015 10:43
@ruben-ayrapetyan
Copy link
Contributor Author

Merged (da7e9d9).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Undesired behaviour ecma builtins Related to ECMA built-in routines ecma core Related to core ECMA functionality normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Assertion 'property_p != NULL' failed in ecma_get_internal_property
3 participants