Implement %TypedArray%.from and fix the issue #1670 (#1679)

JerryScript-DCO-1.0-Signed-off-by: Zidong Jiang zidong.jiang@intel.com
This commit is contained in:
Zidong Jiang
2017-03-24 17:37:22 +08:00
committed by Robert Sipka
parent f50193111b
commit 8571ebfae5
6 changed files with 271 additions and 7 deletions
+28
View File
@@ -26,6 +26,7 @@
#include "jrt-bit-fields.h"
#include "byte-code.h"
#include "re-compiler.h"
#include "ecma-builtins.h"
/** \addtogroup ecma ECMA
* @{
@@ -301,6 +302,33 @@ ecma_set_object_is_builtin (ecma_object_t *object_p) /**< object */
object_p->type_flags_refs = (uint16_t) (object_p->type_flags_refs | ECMA_OBJECT_FLAG_BUILT_IN_OR_LEXICAL_ENV);
} /* ecma_set_object_is_builtin */
/**
* Get the builtin id of the object.
* If the object is not builtin, return ECMA_BUILTIN_ID__COUNT
*/
inline uint8_t
ecma_get_object_builtin_id (ecma_object_t *object_p) /**< object */
{
if (!ecma_get_object_is_builtin (object_p))
{
return ECMA_BUILTIN_ID__COUNT;
}
ecma_built_in_props_t *built_in_props_p;
ecma_object_type_t object_type = ecma_get_object_type (object_p);
if (object_type == ECMA_OBJECT_TYPE_CLASS || object_type == ECMA_OBJECT_TYPE_ARRAY)
{
built_in_props_p = &((ecma_extended_built_in_object_t *) object_p)->built_in;
}
else
{
built_in_props_p = &((ecma_extended_object_t *) object_p)->u.built_in;
}
return built_in_props_p->id;
} /* ecma_get_object_builtin_id */
/**
* Get type of lexical environment.
*/
+1
View File
@@ -293,6 +293,7 @@ void ecma_set_object_type (ecma_object_t *object_p, ecma_object_type_t type);
ecma_object_t *ecma_get_object_prototype (const ecma_object_t *object_p) __attr_pure___;
bool ecma_get_object_is_builtin (const ecma_object_t *object_p) __attr_pure___;
void ecma_set_object_is_builtin (ecma_object_t *object_p);
uint8_t ecma_get_object_builtin_id (ecma_object_t *object_p);
ecma_lexical_environment_type_t ecma_get_lex_env_type (const ecma_object_t *object_p) __attr_pure___;
ecma_object_t *ecma_get_lex_env_outer_reference (const ecma_object_t *object_p) __attr_pure___;
ecma_property_header_t *ecma_get_property_list (const ecma_object_t *object_p) __attr_pure___;