Skip to content

Commit 786dc32

Browse files
zherczegLaszloLango
authored andcommitted
Remove 'ecma_completion_value_t'
Remove ecma_completion_value_t, and add an extra bit to ecma_value_t to represent errors. From the long list of completion types only normal and error remained. JerryScript-DCO-1.0-Signed-off-by: László Langó [email protected] JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
1 parent 85365da commit 786dc32

File tree

96 files changed

+2693
-3274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2693
-3274
lines changed

jerry-core/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@
160160
#endif /* CONFIG_ECMA_COMPACT_PROFILE */
161161

162162
/**
163-
* Number of ecma-values inlined into VM stack frame
163+
* Number of ecma values inlined into VM stack frame
164164
*/
165165
#define CONFIG_VM_STACK_FRAME_INLINED_VALUES_NUMBER (16)
166166

jerry-core/ecma/base/ecma-alloc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ JERRY_STATIC_ASSERT (ECMA_OBJECT_LEX_ENV_TYPE_SIZE <= sizeof (uint64_t) * JERRY_
2929
JERRY_STATIC_ASSERT (sizeof (ecma_collection_header_t) == sizeof (uint64_t));
3030
JERRY_STATIC_ASSERT (sizeof (ecma_collection_chunk_t) == sizeof (uint64_t));
3131
JERRY_STATIC_ASSERT (sizeof (ecma_string_t) == sizeof (uint64_t));
32-
JERRY_STATIC_ASSERT (sizeof (ecma_completion_value_t) == sizeof (uint32_t));
33-
JERRY_STATIC_ASSERT (sizeof (ecma_label_descriptor_t) == sizeof (uint64_t));
3432
JERRY_STATIC_ASSERT (sizeof (ecma_getter_setter_pointers_t) <= sizeof (uint64_t));
3533

3634
/** \addtogroup ecma ECMA
@@ -87,7 +85,6 @@ DECLARE_ROUTINES_FOR (number)
8785
DECLARE_ROUTINES_FOR (collection_header)
8886
DECLARE_ROUTINES_FOR (collection_chunk)
8987
DECLARE_ROUTINES_FOR (string)
90-
DECLARE_ROUTINES_FOR (label_descriptor)
9188
DECLARE_ROUTINES_FOR (getter_setter_pointers)
9289
DECLARE_ROUTINES_FOR (external_pointer)
9390

jerry-core/ecma/base/ecma-alloc.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -97,18 +97,6 @@ extern ecma_string_t *ecma_alloc_string (void);
9797
*/
9898
extern void ecma_dealloc_string (ecma_string_t *);
9999

100-
/**
101-
* Allocate memory for label descriptor
102-
*
103-
* @return pointer to allocated memory
104-
*/
105-
extern ecma_label_descriptor_t *ecma_alloc_label_descriptor (void);
106-
107-
/**
108-
* Dealloc memory from label descriptor
109-
*/
110-
extern void ecma_dealloc_label_descriptor (ecma_label_descriptor_t *);
111-
112100
/**
113101
* Allocate memory for getter-setter pointer pair
114102
*

jerry-core/ecma/base/ecma-gc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,8 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
329329

330330
switch (property_id)
331331
{
332-
case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* a collection of ecma-values */
333-
case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* a collection of ecma-values */
332+
case ECMA_INTERNAL_PROPERTY_NUMBER_INDEXED_ARRAY_VALUES: /* a collection of ecma values */
333+
case ECMA_INTERNAL_PROPERTY_STRING_INDEXED_ARRAY_VALUES: /* a collection of ecma values */
334334
{
335335
JERRY_UNIMPLEMENTED ("Indexed array storage is not implemented yet.");
336336
}
@@ -363,7 +363,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
363363
break;
364364
}
365365

366-
case ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_BOUND_THIS: /* an ecma-value */
366+
case ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_BOUND_THIS: /* an ecma value */
367367
{
368368
if (ecma_is_value_object (property_value))
369369
{
@@ -375,7 +375,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
375375
break;
376376
}
377377

378-
case ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_BOUND_ARGS: /* a collection of ecma-values */
378+
case ECMA_INTERNAL_PROPERTY_BOUND_FUNCTION_BOUND_ARGS: /* a collection of ecma values */
379379
{
380380
ecma_collection_header_t *bound_arg_list_p = ECMA_GET_NON_NULL_POINTER (ecma_collection_header_t,
381381
property_value);

jerry-core/ecma/base/ecma-globals.h

Lines changed: 15 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
*/
3535

3636
/**
37-
* Ecma-pointer field is used to calculate ecma-value's address.
37+
* Ecma-pointer field is used to calculate ecma value's address.
3838
*
3939
* Ecma-pointer contains value's shifted offset from common Ecma-pointers' base.
4040
* The offset is shifted right by MEM_ALIGNMENT_LOG.
@@ -52,7 +52,7 @@
5252
*/
5353

5454
/**
55-
* Type of ecma-value
55+
* Type of ecma value
5656
*/
5757
typedef enum
5858
{
@@ -63,7 +63,7 @@ typedef enum
6363
} ecma_type_t;
6464

6565
/**
66-
* Simple ecma-values
66+
* Simple ecma values
6767
*/
6868
typedef enum
6969
{
@@ -80,7 +80,7 @@ typedef enum
8080
ECMA_SIMPLE_VALUE_TRUE, /**< boolean true */
8181
ECMA_SIMPLE_VALUE_ARRAY_HOLE, /**< array hole, used for initialization of an array literal */
8282
ECMA_SIMPLE_VALUE_REGISTER_REF, /**< register reference, a special "base" value for vm */
83-
ECMA_SIMPLE_VALUE__COUNT /** count of simple ecma-values */
83+
ECMA_SIMPLE_VALUE__COUNT /** count of simple ecma values */
8484
} ecma_simple_value_t;
8585

8686
/**
@@ -94,40 +94,9 @@ typedef enum
9494
} ecma_property_type_t;
9595

9696
/**
97-
* Type of block evaluation (completion) result.
97+
* Description of an ecma value
9898
*
99-
* See also: ECMA-262 v5, 8.9.
100-
*/
101-
typedef enum
102-
{
103-
ECMA_COMPLETION_TYPE_NORMAL, /**< default completion */
104-
ECMA_COMPLETION_TYPE_RETURN, /**< completion with return */
105-
ECMA_COMPLETION_TYPE_JUMP, /**< implementation-defined completion type
106-
* for jump statements (break, continue)
107-
* that require completion of one or several
108-
* statements, before performing related jump.
109-
*
110-
* For example, 'break' in the following code
111-
* requires to return from opfunc_with handler
112-
* before performing jump to the loop end:
113-
*
114-
* for (var i = 0; i < 10; i++)
115-
* {
116-
* with (obj)
117-
* {
118-
* break;
119-
* }
120-
* }
121-
*/
122-
ECMA_COMPLETION_TYPE_THROW, /**< completion with throw */
123-
ECMA_COMPLETION_TYPE_META /**< implementation-defined completion type
124-
for meta opcode */
125-
} ecma_completion_type_t;
126-
127-
/**
128-
* Description of an ecma-value
129-
*
130-
* Bit-field structure: type (2) | value (ECMA_POINTER_FIELD_WIDTH)
99+
* Bit-field structure: type (2) | error (1) | value (ECMA_POINTER_FIELD_WIDTH)
131100
*/
132101
typedef uint32_t ecma_value_t;
133102

@@ -138,63 +107,23 @@ typedef uint32_t ecma_value_t;
138107
#define ECMA_VALUE_TYPE_WIDTH (2)
139108

140109
/**
141-
* Simple value (ecma_simple_value_t) or compressed pointer to value (depending on value_type)
110+
* Value is error (boolean)
142111
*/
143-
#define ECMA_VALUE_VALUE_POS (ECMA_VALUE_TYPE_POS + \
112+
#define ECMA_VALUE_ERROR_POS (ECMA_VALUE_TYPE_POS + \
144113
ECMA_VALUE_TYPE_WIDTH)
145-
#define ECMA_VALUE_VALUE_WIDTH (ECMA_POINTER_FIELD_WIDTH)
146-
147-
/**
148-
* Size of ecma value description, in bits
149-
*/
150-
#define ECMA_VALUE_SIZE (ECMA_VALUE_VALUE_POS + ECMA_VALUE_VALUE_WIDTH)
151-
152-
/**
153-
* Description of a block completion value
154-
*
155-
* See also: ECMA-262 v5, 8.9.
156-
*
157-
* value (16)
158-
* Bit-field structure: type (8) | padding (8) <
159-
* break / continue target
160-
*/
161-
typedef uint32_t ecma_completion_value_t;
114+
#define ECMA_VALUE_ERROR_WIDTH (1)
162115

163116
/**
164-
* Value
165-
*
166-
* Used for normal, return, throw and exit completion types.
167-
*/
168-
#define ECMA_COMPLETION_VALUE_VALUE_POS (0)
169-
#define ECMA_COMPLETION_VALUE_VALUE_WIDTH (ECMA_VALUE_SIZE)
170-
171-
/**
172-
* Type (ecma_completion_type_t)
173-
*/
174-
#define ECMA_COMPLETION_VALUE_TYPE_POS (JERRY_ALIGNUP (ECMA_COMPLETION_VALUE_VALUE_POS + \
175-
ECMA_COMPLETION_VALUE_VALUE_WIDTH, \
176-
JERRY_BITSINBYTE))
177-
#define ECMA_COMPLETION_VALUE_TYPE_WIDTH (8)
178-
179-
/**
180-
* Size of ecma completion value description, in bits
117+
* Simple value (ecma_simple_value_t) or compressed pointer to value (depending on value_type)
181118
*/
182-
#define ECMA_COMPLETION_VALUE_SIZE (ECMA_COMPLETION_VALUE_TYPE_POS + \
183-
ECMA_COMPLETION_VALUE_TYPE_WIDTH)
119+
#define ECMA_VALUE_VALUE_POS (ECMA_VALUE_ERROR_POS + \
120+
ECMA_VALUE_ERROR_WIDTH)
121+
#define ECMA_VALUE_VALUE_WIDTH (ECMA_POINTER_FIELD_WIDTH)
184122

185123
/**
186-
* Label
187-
*
188-
* Used for break and continue completion types.
124+
* Size of ecma value description, in bits
189125
*/
190-
typedef struct
191-
{
192-
/** Target's offset */
193-
uint32_t offset;
194-
195-
/** Levels to label left */
196-
uint32_t depth;
197-
} ecma_label_descriptor_t;
126+
#define ECMA_VALUE_SIZE (ECMA_VALUE_VALUE_POS + ECMA_VALUE_VALUE_WIDTH)
198127

199128
/**
200129
* Internal properties' identifiers.

0 commit comments

Comments
 (0)