Adding libecmaoperations module that implements ECMA-262 defined operations.

This commit is contained in:
Ruben Ayrapetyan
2014-07-10 14:28:01 +04:00
parent c4d2c4c916
commit fa63065412
5 changed files with 92 additions and 3 deletions
+9 -1
View File
@@ -38,6 +38,14 @@
#include "ecma-gc.h"
#include "mem-poolman.h"
JERRY_STATIC_ASSERT( sizeof (ecma_Value_t) <= sizeof (uint16_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_Property_t) <= sizeof (uint64_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_Object_t) <= sizeof (uint64_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_ArrayHeader_t) <= sizeof (uint32_t) );
JERRY_STATIC_ASSERT( sizeof (ecma_ArrayFirstChunk_t) == ECMA_ARRAY_CHUNK_SIZE_IN_BYTES );
JERRY_STATIC_ASSERT( sizeof (ecma_ArrayNonFirstChunk_t) == ECMA_ARRAY_CHUNK_SIZE_IN_BYTES );
JERRY_STATIC_ASSERT( sizeof (ecma_CompletionValue_t) == sizeof(uint32_t) );
/**
* Template of an allocation routine.
*/
@@ -79,4 +87,4 @@ DECLARE_ROUTINES_FOR (ArrayNonFirstChunk)
/**
* @}
* @}
*/
*/
+33
View File
@@ -67,6 +67,10 @@ typedef enum {
ECMA_SIMPLE_VALUE_NULL, /**< null value */
ECMA_SIMPLE_VALUE_FALSE, /**< boolean false */
ECMA_SIMPLE_VALUE_TRUE, /**< boolean true */
ECMA_SIMPLE_VALUE_EMPTY, /**< empty value (see also: ECMA-262 v5, 8.9 Completion specification type) */
ECMA_SIMPLE_VALUE_ARRAY_REDIRECT, /**< special value for an array's elements that exists,
but is stored directly in the array's property list
(used for array elements with non-default attribute values) */
ECMA_SIMPLE_VALUE__COUNT /** count of simple ecma-values */
} ecma_SimpleValue_t;
@@ -79,6 +83,19 @@ typedef enum {
ECMA_PROPERTY_INTERNAL /**< internal property */
} ecma_PropertyType_t;
/**
* Type of block evaluation (completion) result.
*
* See also: ECMA-262 v5, 8.9.
*/
typedef enum {
ECMA_COMPLETION_TYPE_NORMAL, /**< default block completion */
ECMA_COMPLETION_TYPE_RETURN, /**< block completed with return */
ECMA_COMPLETION_TYPE_BREAK, /**< block completed with break */
ECMA_COMPLETION_TYPE_CONTINUE, /**< block completed with continue */
ECMA_COMPLETION_TYPE_THROW /**< block completed with throw */
} ecma_CompletionType_t;
/**
* Description of an ecma-value
*/
@@ -92,6 +109,22 @@ typedef struct {
uint32_t m_Value : ECMA_POINTER_FIELD_WIDTH;
} __packed ecma_Value_t;
/**
* Description of a block completion value
*
* See also: ECMA-262 v5, 8.9.
*/
typedef struct {
/** Type (ecma_CompletionType_t) */
uint32_t completion_type : 3;
/** Value */
ecma_Value_t completion_value;
/** Target */
uint32_t target : 8;
} __packed ecma_CompletionValue_t;
/**
* Internal properties' identifiers.
*/