@@ -462,18 +462,17 @@ ecma_get_completion_value_value_field (ecma_completion_value_t completion_value)
462
462
} /* ecma_get_completion_value_value_field */
463
463
464
464
/* *
465
- * Get pointer to label descriptor from completion value
465
+ * Get target of break / continue completion value
466
466
*
467
- * @return pointer to label descriptor
467
+ * @return opcode counter
468
468
*/
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 */
471
471
{
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 */
477
476
478
477
/* *
479
478
* Set type field of completion value
@@ -508,24 +507,20 @@ ecma_set_completion_value_value_field (ecma_completion_value_t completion_value,
508
507
} /* ecma_set_completion_value_value_field */
509
508
510
509
/* *
511
- * Set label descriptor of completion value
510
+ * Set target of break / continue completion value
512
511
*
513
512
* @return completion value with updated field
514
513
*/
515
514
static 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 */
520
518
{
521
- uintptr_t label_desc_cp;
522
- ECMA_SET_NON_NULL_POINTER (label_desc_cp, label_desc_p);
523
-
524
519
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 */
529
524
530
525
/* *
531
526
* Normal, throw, return, exit and meta completion values constructor
@@ -555,34 +550,6 @@ ecma_make_completion_value (ecma_completion_type_t type, /**< type */
555
550
return completion_value;
556
551
} /* ecma_make_completion_value */
557
552
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
-
586
553
/* *
587
554
* Simple normal completion value constructor
588
555
*
@@ -688,6 +655,24 @@ ecma_make_meta_completion_value (void)
688
655
ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY));
689
656
} /* ecma_make_meta_completion_value */
690
657
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_BREAK_CONTINUE);
670
+ completion_value = ecma_set_completion_value_target (completion_value,
671
+ target);
672
+
673
+ return completion_value;
674
+ } /* ecma_make_jump_completion_value */
675
+
691
676
/* *
692
677
* Get ecma-value from specified completion value
693
678
*
@@ -741,6 +726,20 @@ ecma_get_object_from_completion_value (ecma_completion_value_t completion_value)
741
726
return ecma_get_object_from_value (ecma_get_completion_value_value (completion_value));
742
727
} /* ecma_get_object_from_completion_value */
743
728
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_BREAK_CONTINUE);
739
+
740
+ return ecma_get_completion_value_target (completion_value);
741
+ } /* ecma_get_jump_target_from_completion_value */
742
+
744
743
/* *
745
744
* Copy ecma-completion value.
746
745
*
@@ -753,6 +752,7 @@ ecma_copy_completion_value (ecma_completion_value_t value) /**< completion value
753
752
const bool is_type_ok = (type == ECMA_COMPLETION_TYPE_NORMAL
754
753
|| type == ECMA_COMPLETION_TYPE_THROW
755
754
|| type == ECMA_COMPLETION_TYPE_RETURN
755
+ || type == ECMA_COMPLETION_TYPE_BREAK_CONTINUE
756
756
|| type == ECMA_COMPLETION_TYPE_EXIT);
757
757
758
758
JERRY_ASSERT (is_type_ok);
@@ -784,10 +784,8 @@ ecma_free_completion_value (ecma_completion_value_t completion_value) /**< compl
784
784
JERRY_ASSERT (ecma_get_value_type_field (v) == ECMA_TYPE_SIMPLE);
785
785
break ;
786
786
}
787
- case ECMA_COMPLETION_TYPE_CONTINUE:
788
- case ECMA_COMPLETION_TYPE_BREAK:
787
+ case ECMA_COMPLETION_TYPE_BREAK_CONTINUE:
789
788
{
790
- ecma_dealloc_label_descriptor (ecma_get_completion_value_label_descriptor (completion_value));
791
789
break ;
792
790
}
793
791
case ECMA_COMPLETION_TYPE_META:
@@ -876,28 +874,16 @@ ecma_is_completion_value_meta (ecma_completion_value_t value) /**< completion va
876
874
} /* ecma_is_completion_value_meta */
877
875
878
876
/* *
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.
892
878
*
893
- * @return true - if the completion type is continue,
879
+ * @return true - if the completion type is break / continue,
894
880
* false - otherwise.
895
881
*/
896
882
bool __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 */
898
884
{
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_BREAK_CONTINUE );
886
+ } /* ecma_is_completion_value_jump */
901
887
902
888
/* *
903
889
* Check if the completion value is specified normal simple value.
0 commit comments