Adding libecmaoperations module that implements ECMA-262 defined operations.
This commit is contained in:
@@ -35,6 +35,7 @@ SOURCES = \
|
||||
$(wildcard ./src/libperipherals/actuators.c) \
|
||||
$(wildcard ./src/libjsparser/*.c) \
|
||||
$(wildcard ./src/libecmaobjects/*.c) \
|
||||
$(wildcard ./src/libecmaoperations/*.c) \
|
||||
$(wildcard ./src/liballocator/*.c) \
|
||||
$(wildcard ./src/libcoreint/*.c) )
|
||||
|
||||
@@ -47,6 +48,7 @@ HEADERS = \
|
||||
$(wildcard ./src/libperipherals/*.h) \
|
||||
$(wildcard ./src/libjsparser/*.h) \
|
||||
$(wildcard ./src/libecmaobjects/*.h) \
|
||||
$(wildcard ./src/libecmaoperations/*.h) \
|
||||
$(wildcard ./src/liballocator/*.h) \
|
||||
$(wildcard ./src/libcoreint/*.h) )
|
||||
|
||||
@@ -55,6 +57,7 @@ INCLUDES = \
|
||||
-I src/libperipherals \
|
||||
-I src/libjsparser \
|
||||
-I src/libecmaobjects \
|
||||
-I src/libecmaoperations \
|
||||
-I src/liballocator \
|
||||
-I src/libcoreint
|
||||
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-operations.h"
|
||||
#include "error.h"
|
||||
#include "opcodes.h"
|
||||
#include "interpreter.h"
|
||||
#include "opcodes.h"
|
||||
|
||||
void
|
||||
save_op_data (int pos, OPCODE opdata)
|
||||
@@ -40,7 +41,14 @@ void opfunc_varg_3 (OPCODE opdata __unused, struct __int_data *int_data __unused
|
||||
void opfunc_varg_3_end (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); }
|
||||
void opfunc_retval (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); }
|
||||
void opfunc_ret (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); }
|
||||
void opfunc_assignment (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); }
|
||||
|
||||
void
|
||||
opfunc_assignment(OPCODE opdata __unused,
|
||||
struct __int_data *int_data __unused)
|
||||
{
|
||||
JERRY_UNREACHABLE ();
|
||||
}
|
||||
|
||||
void opfunc_assignment_multiplication (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); }
|
||||
void opfunc_assignment_devision (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); }
|
||||
void opfunc_assignment_remainder (OPCODE opdata __unused, struct __int_data *int_data __unused) { JERRY_UNREACHABLE (); }
|
||||
|
||||
@@ -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)
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
*/
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/* Copyright 2014 Samsung Electronics Co., Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef JERRY_ECMA_OPERATIONS_H
|
||||
#define JERRY_ECMA_OPERATIONS_H
|
||||
|
||||
/** \addtogroup ecma ---TODO---
|
||||
* @{
|
||||
*
|
||||
* \addtogroup ecmaoperations ECMA-defined operations
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-reference.h"
|
||||
|
||||
extern ecma_CompletionValue_t ecma_GetValue( ecma_SyntacticReference_t *ref_p);
|
||||
extern ecma_CompletionValue_t ecma_SetValue( ecma_SyntacticReference_t *ref_p, ecma_Value_t value);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* JERRY_ECMA_OPERATIONS_H */
|
||||
Reference in New Issue
Block a user