-
Notifications
You must be signed in to change notification settings - Fork 684
Implement the core of the map object. #2447
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
Conversation
dea3bd1
to
e161ed2
Compare
Patch ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice patch, just a few things I've noticed.
bool is_weak_map) /**< map is weak map */ | ||
{ | ||
JERRY_UNUSED (key_arg); | ||
JERRY_UNUSED (value_arg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both JERRY_UNUSED
are unnecessary.
53ba82b
to
ee0afe5
Compare
6e78d44
to
5d58780
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
P.S.: It would be great to add more tests to jerry-test-suite/es2015
too. It can be done in a followup PR.
jerry-core/ecma/base/ecma-gc.c
Outdated
@@ -33,10 +33,13 @@ | |||
|
|||
#ifndef CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN | |||
#include "ecma-typedarray-object.h" | |||
#endif | |||
#endif /* CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* !CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN */
jerry-core/ecma/base/ecma-gc.c
Outdated
#endif /* CONFIG_DISABLE_ES2015_PROMISE_BUILTIN */ | ||
#ifndef CONFIG_DISABLE_ES2015_MAP_BUILTIN | ||
#include "ecma-map-object.h" | ||
#endif /* CONFIG_DISABLE_ES2015_MAP_BUILTIN */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
jerry-core/ecma/base/ecma-gc.c
Outdated
} | ||
} /* ecma_gc_mark_map_object */ | ||
|
||
#endif /* CONFIG_DISABLE_ES2015_MAP_BUILTIN */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
jerry-core/ecma/base/ecma-gc.c
Outdated
ecma_value_p = ecma_collection_iterator_init (((ecma_promise_object_t *) ext_object_p)->reject_reactions); | ||
|
||
while (ecma_value_p != NULL) | ||
#endif /* CONFIG_DISABLE_ES2015_MAP_BUILTIN */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
jerry-core/ecma/base/ecma-gc.c
Outdated
ecma_dealloc_extended_object (object_p, sizeof (ecma_map_object_t)); | ||
return; | ||
} | ||
#endif /* CONFIG_DISABLE_ES2015_MAP_BUILTIN */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
jerry-core/ecma/base/ecma-globals.h
Outdated
* the rest can be ECMA_VALUE_ARRAY_HOLE or any valid value. */ | ||
} ecma_map_object_chunk_t; | ||
|
||
#endif /* CONFIG_DISABLE_ES2015_MAP_BUILTIN */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
* @} | ||
*/ | ||
|
||
#endif /* CONFIG_DISABLE_ES2015_MAP_BUILTIN */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
* @} | ||
*/ | ||
|
||
#endif /* CONFIG_DISABLE_ES2015_MAP_BUILTIN */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* !CONFIG_DISABLE_ES2015_MAP_BUILTIN */
|
||
#endif /* CONFIG_DISABLE_ES2015_MAP_BUILTIN */ | ||
|
||
#endif /* ECMA_MAP_OBJECT_H */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* !ECMA_MAP_OBJECT_H */
|
||
if (!ecma_is_value_pointer (item)) | ||
{ | ||
if (ecma_is_value_object (item)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is just a nit-picking, but I think you could merge these two conditions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We cannot because we would enter into the else
branch when value is pointer.
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
5d58780
to
a0e67d8
Compare
Thank you for the review, patch is updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Heavily under construction. set/get/has and gc marking is working with Map. Next step is delete. WeakMap is there as well, but I realized the gc marking for WeakMaps can be too costly.