@@ -462,18 +462,17 @@ ecma_get_completion_value_value_field (ecma_completion_value_t completion_value)
462462} /* ecma_get_completion_value_value_field */
463463
464464/* *
465- * Get pointer to label descriptor from completion value
465+ * Get target of break / continue completion value
466466 *
467- * @return pointer to label descriptor
467+ * @return opcode counter
468468 */
469- static ecma_label_descriptor_t * __attr_const___
470- ecma_get_completion_value_label_descriptor (ecma_completion_value_t completion_value) /* *< completion value */
469+ static opcode_counter_t
470+ ecma_get_completion_value_target (ecma_completion_value_t completion_value) /* *< completion value */
471471{
472- return ECMA_GET_NON_NULL_POINTER (ecma_label_descriptor_t ,
473- (uintptr_t ) jrt_extract_bit_field (completion_value,
474- ECMA_COMPLETION_VALUE_LABEL_DESC_CP_POS,
475- ECMA_COMPLETION_VALUE_LABEL_DESC_CP_WIDTH));
476- } /* ecma_get_completion_value_label_descriptor */
472+ return (opcode_counter_t ) jrt_extract_bit_field (completion_value,
473+ ECMA_COMPLETION_VALUE_TARGET_POS,
474+ ECMA_COMPLETION_VALUE_TARGET_WIDTH);
475+ } /* ecma_get_completion_value_target */
477476
478477/* *
479478 * Set type field of completion value
@@ -508,24 +507,20 @@ ecma_set_completion_value_value_field (ecma_completion_value_t completion_value,
508507} /* ecma_set_completion_value_value_field */
509508
510509/* *
511- * Set label descriptor of completion value
510+ * Set target of break / continue completion value
512511 *
513512 * @return completion value with updated field
514513 */
515514static ecma_completion_value_t __attr_const___
516- ecma_set_completion_value_label_descriptor (ecma_completion_value_t completion_value, /* *< completion value
517- * to set field in */
518- ecma_label_descriptor_t * label_desc_p) /* *< pointer to the
519- * label descriptor */
515+ ecma_set_completion_value_target (ecma_completion_value_t completion_value, /* *< completion value
516+ * to set field in */
517+ opcode_counter_t target) /* *< break / continue target */
520518{
521- uintptr_t label_desc_cp;
522- ECMA_SET_NON_NULL_POINTER (label_desc_cp, label_desc_p);
523-
524519 return (ecma_completion_value_t ) jrt_set_bit_field_value (completion_value,
525- label_desc_cp ,
526- ECMA_COMPLETION_VALUE_LABEL_DESC_CP_POS ,
527- ECMA_COMPLETION_VALUE_LABEL_DESC_CP_WIDTH );
528- } /* ecma_set_completion_value_label_descriptor */
520+ target ,
521+ ECMA_COMPLETION_VALUE_TARGET_POS ,
522+ ECMA_COMPLETION_VALUE_TARGET_WIDTH );
523+ } /* ecma_set_completion_value_target */
529524
530525/* *
531526 * Normal, throw, return, exit and meta completion values constructor
@@ -555,34 +550,6 @@ ecma_make_completion_value (ecma_completion_type_t type, /**< type */
555550 return completion_value;
556551} /* ecma_make_completion_value */
557552
558- /* *
559- * Break and continue completion values constructor
560- *
561- * @return completion value
562- */
563- ecma_completion_value_t __attr_const___
564- ecma_make_label_completion_value (ecma_completion_type_t type, /* *< type */
565- uint8_t depth_level, /* *< depth level (in try constructions,
566- with blocks, etc.) */
567- uint16_t offset) /* *< offset to label from end of last block */
568- {
569- JERRY_ASSERT (type == ECMA_COMPLETION_TYPE_BREAK
570- || type == ECMA_COMPLETION_TYPE_CONTINUE);
571-
572- ecma_label_descriptor_t *label_desc_p = ecma_alloc_label_descriptor ();
573- label_desc_p->offset = offset;
574- label_desc_p->depth = depth_level;
575-
576- ecma_completion_value_t completion_value = 0 ;
577-
578- completion_value = ecma_set_completion_value_type_field (completion_value,
579- type);
580- completion_value = ecma_set_completion_value_label_descriptor (completion_value,
581- label_desc_p);
582-
583- return completion_value;
584- } /* ecma_make_label_completion_value */
585-
586553/* *
587554 * Simple normal completion value constructor
588555 *
@@ -688,6 +655,24 @@ ecma_make_meta_completion_value (void)
688655 ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY));
689656} /* ecma_make_meta_completion_value */
690657
658+ /* *
659+ * Break / continue completion values constructor
660+ *
661+ * @return completion value
662+ */
663+ ecma_completion_value_t __attr_const___
664+ ecma_make_jump_completion_value (opcode_counter_t target) /* *< target break / continue */
665+ {
666+ ecma_completion_value_t completion_value = 0 ;
667+
668+ completion_value = ecma_set_completion_value_type_field (completion_value,
669+ ECMA_COMPLETION_TYPE_JUMP);
670+ completion_value = ecma_set_completion_value_target (completion_value,
671+ target);
672+
673+ return completion_value;
674+ } /* ecma_make_jump_completion_value */
675+
691676/* *
692677 * Get ecma-value from specified completion value
693678 *
@@ -741,6 +726,20 @@ ecma_get_object_from_completion_value (ecma_completion_value_t completion_value)
741726 return ecma_get_object_from_value (ecma_get_completion_value_value (completion_value));
742727} /* ecma_get_object_from_completion_value */
743728
729+ /* *
730+ * Get break / continue target from completion value
731+ *
732+ * @return opcode counter
733+ */
734+ opcode_counter_t
735+ ecma_get_jump_target_from_completion_value (ecma_completion_value_t completion_value) /* *< completion
736+ * value */
737+ {
738+ JERRY_ASSERT (ecma_get_completion_value_type_field (completion_value) == ECMA_COMPLETION_TYPE_JUMP);
739+
740+ return ecma_get_completion_value_target (completion_value);
741+ } /* ecma_get_jump_target_from_completion_value */
742+
744743/* *
745744 * Copy ecma-completion value.
746745 *
@@ -753,6 +752,7 @@ ecma_copy_completion_value (ecma_completion_value_t value) /**< completion value
753752 const bool is_type_ok = (type == ECMA_COMPLETION_TYPE_NORMAL
754753 || type == ECMA_COMPLETION_TYPE_THROW
755754 || type == ECMA_COMPLETION_TYPE_RETURN
755+ || type == ECMA_COMPLETION_TYPE_JUMP
756756 || type == ECMA_COMPLETION_TYPE_EXIT);
757757
758758 JERRY_ASSERT (is_type_ok);
@@ -784,10 +784,8 @@ ecma_free_completion_value (ecma_completion_value_t completion_value) /**< compl
784784 JERRY_ASSERT (ecma_get_value_type_field (v) == ECMA_TYPE_SIMPLE);
785785 break ;
786786 }
787- case ECMA_COMPLETION_TYPE_CONTINUE:
788- case ECMA_COMPLETION_TYPE_BREAK:
787+ case ECMA_COMPLETION_TYPE_JUMP:
789788 {
790- ecma_dealloc_label_descriptor (ecma_get_completion_value_label_descriptor (completion_value));
791789 break ;
792790 }
793791 case ECMA_COMPLETION_TYPE_META:
@@ -876,28 +874,16 @@ ecma_is_completion_value_meta (ecma_completion_value_t value) /**< completion va
876874} /* ecma_is_completion_value_meta */
877875
878876/* *
879- * Check if the completion value is break value.
880- *
881- * @return true - if the completion type is break,
882- * false - otherwise.
883- */
884- bool __attr_const___ __attr_always_inline___
885- ecma_is_completion_value_break (ecma_completion_value_t value) /* *< completion value */
886- {
887- return (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_BREAK);
888- } /* ecma_is_completion_value_break */
889-
890- /* *
891- * Check if the completion value is continue value.
877+ * Check if the completion value is break / continue value.
892878 *
893- * @return true - if the completion type is continue,
879+ * @return true - if the completion type is break / continue,
894880 * false - otherwise.
895881 */
896882bool __attr_const___ __attr_always_inline___
897- ecma_is_completion_value_continue (ecma_completion_value_t value) /* *< completion value */
883+ ecma_is_completion_value_jump (ecma_completion_value_t value) /* *< completion value */
898884{
899- return (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_CONTINUE );
900- } /* ecma_is_completion_value_continue */
885+ return (ecma_get_completion_value_type_field (value) == ECMA_COMPLETION_TYPE_JUMP );
886+ } /* ecma_is_completion_value_jump */
901887
902888/* *
903889 * Check if the completion value is specified normal simple value.
0 commit comments