From a1f95048ae821ec3fbbfc5a3b2a856dcae7dab2c Mon Sep 17 00:00:00 2001 From: Ruben Ayrapetyan Date: Fri, 30 Jan 2015 22:59:25 +0300 Subject: [PATCH] Removing label completion values. --- src/libcoreint/interpreter.c | 8 ---- src/libecmaobjects/ecma-globals.h | 2 - src/libecmaobjects/ecma-value.c | 68 ------------------------------- src/libecmaobjects/ecma-value.h | 43 ++----------------- 4 files changed, 3 insertions(+), 118 deletions(-) diff --git a/src/libcoreint/interpreter.c b/src/libcoreint/interpreter.c index 6d609818e..fd758f46b 100644 --- a/src/libcoreint/interpreter.c +++ b/src/libcoreint/interpreter.c @@ -438,14 +438,6 @@ run_int_loop (int_data_t *int_data) } while (ecma_is_completion_value_normal (completion)); - if (ecma_is_completion_value_break (completion) - || ecma_is_completion_value_continue (completion)) - { - JERRY_UNIMPLEMENTED ("break and continue on labels are not supported."); - - continue; - } - if (ecma_is_completion_value_meta (completion)) { completion = ecma_make_empty_completion_value (); diff --git a/src/libecmaobjects/ecma-globals.h b/src/libecmaobjects/ecma-globals.h index fe80bbbb2..0895035d0 100644 --- a/src/libecmaobjects/ecma-globals.h +++ b/src/libecmaobjects/ecma-globals.h @@ -101,8 +101,6 @@ 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 */ #ifdef CONFIG_ECMA_EXCEPTION_SUPPORT ECMA_COMPLETION_TYPE_THROW, /**< block completed with throw */ #endif /* CONFIG_ECMA_EXCEPTION_SUPPORT */ diff --git a/src/libecmaobjects/ecma-value.c b/src/libecmaobjects/ecma-value.c index a7ea5a0dd..58d2c4159 100644 --- a/src/libecmaobjects/ecma-value.c +++ b/src/libecmaobjects/ecma-value.c @@ -178,68 +178,6 @@ ecma_free_value (ecma_value_t& value, /**< value description */ } } /* ecma_free_value */ -/** - * Get pointer to label descriptor from completion value - * - * @return pointer to label descriptor - */ -static ecma_label_descriptor_t* __attribute_const__ -ecma_get_completion_value_label_descriptor (ecma_completion_value_t completion_value) /**< completion value */ -{ - return ECMA_GET_NON_NULL_POINTER (ecma_label_descriptor_t, - (uintptr_t) jrt_extract_bit_field (completion_value, - ECMA_COMPLETION_VALUE_LABEL_DESC_CP_POS, - ECMA_COMPLETION_VALUE_LABEL_DESC_CP_WIDTH)); -} /* ecma_get_completion_value_label_descriptor */ - -/** - * Set label descriptor of completion value - * - * @return completion value with updated field - */ -static ecma_completion_value_t __attribute_const__ -ecma_set_completion_value_label_descriptor (ecma_completion_value_t completion_value, /**< completion value - * to set field in */ - ecma_label_descriptor_t* label_desc_p) /**< pointer to the - * label descriptor */ -{ - uintptr_t label_desc_cp; - ECMA_SET_NON_NULL_POINTER (label_desc_cp, label_desc_p); - - return (ecma_completion_value_t) jrt_set_bit_field_value (completion_value, - label_desc_cp, - ECMA_COMPLETION_VALUE_LABEL_DESC_CP_POS, - ECMA_COMPLETION_VALUE_LABEL_DESC_CP_WIDTH); -} /* ecma_set_completion_value_label_descriptor */ - -/** - * Break and continue completion values constructor - * - * @return completion value - */ -ecma_completion_value_t __attribute_const__ -ecma_make_label_completion_value (ecma_completion_type_t type, /**< type */ - uint8_t depth_level, /**< depth level (in try constructions, - with blocks, etc.) */ - uint16_t offset) /**< offset to label from end of last block */ -{ - JERRY_ASSERT (type == ECMA_COMPLETION_TYPE_BREAK - || type == ECMA_COMPLETION_TYPE_CONTINUE); - - ecma_label_descriptor_t *label_desc_p = ecma_alloc_label_descriptor (); - label_desc_p->offset = offset; - label_desc_p->depth = depth_level; - - ecma_completion_value_t completion_value = 0; - - completion_value = ecma_set_completion_value_type_field (completion_value, - type); - completion_value = ecma_set_completion_value_label_descriptor (completion_value, - label_desc_p); - - return completion_value; -} /* ecma_make_label_completion_value */ - /** * Throw completion value constructor. * @@ -312,12 +250,6 @@ ecma_free_completion_value (ecma_completion_value_t completion_value) /**< compl break; } - case ECMA_COMPLETION_TYPE_CONTINUE: - case ECMA_COMPLETION_TYPE_BREAK: - { - ecma_dealloc_label_descriptor (ecma_get_completion_value_label_descriptor (completion_value)); - break; - } case ECMA_COMPLETION_TYPE_META: { JERRY_UNREACHABLE (); diff --git a/src/libecmaobjects/ecma-value.h b/src/libecmaobjects/ecma-value.h index 20bb2f8da..db54c9d35 100644 --- a/src/libecmaobjects/ecma-value.h +++ b/src/libecmaobjects/ecma-value.h @@ -174,9 +174,9 @@ class ecma_value_t * * See also: ECMA-262 v5, 8.9. * - * value (16) - * Bit-field structure: type (8) | padding (8) < - * label_desc_cp (16) + * + * Bit-field structure: type (8) | padding (8) | value (16) + * */ typedef uint32_t ecma_completion_value_t; @@ -201,16 +201,6 @@ typedef uint32_t ecma_completion_value_t; ECMA_COMPLETION_VALUE_PADDING_WIDTH) #define ECMA_COMPLETION_VALUE_VALUE_WIDTH (ECMA_VALUE_SIZE) -/** - * Label - * - * Used for break and continue completion types. - */ -#define ECMA_COMPLETION_VALUE_LABEL_DESC_CP_POS (ECMA_COMPLETION_VALUE_TYPE_POS + \ - ECMA_COMPLETION_VALUE_TYPE_WIDTH + \ - ECMA_COMPLETION_VALUE_PADDING_WIDTH) -#define ECMA_COMPLETION_VALUE_LABEL_DESC_CP_WIDTH (ECMA_POINTER_FIELD_WIDTH) - /** * Get type field of ecma-value * @@ -437,9 +427,6 @@ ecma_make_completion_value (ecma_completion_type_t type, /**< type */ return completion_value; } /* ecma_make_completion_value */ -extern ecma_completion_value_t ecma_make_label_completion_value (ecma_completion_type_t type, - uint8_t depth_level, - uint16_t offset); /** * Simple normal completion value constructor * @@ -659,30 +646,6 @@ ecma_is_completion_value_meta (ecma_completion_value_t value) /**< completion va } } /* ecma_is_completion_value_meta */ -/** - * Check if the completion value is break value. - * - * @return true - if the completion type is break, - * false - otherwise. - */ -inline bool __attribute_const__ __attribute_always_inline__ -ecma_is_completion_value_break (ecma_completion_value_t value) /**< completion value */ -{ - return (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_BREAK); -} /* ecma_is_completion_value_break */ - -/** - * Check if the completion value is continue value. - * - * @return true - if the completion type is continue, - * false - otherwise. - */ -inline bool __attribute_const__ __attribute_always_inline__ -ecma_is_completion_value_continue (ecma_completion_value_t value) /**< completion value */ -{ - return (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_CONTINUE); -} /* ecma_is_completion_value_continue */ - /** * Check if the completion value is specified normal simple value. *