@@ -544,6 +544,7 @@ vm_run_from_pos (const opcode_t *opcodes_p, /**< byte-code array */
544
544
int_data.lex_env_p = lex_env_p;
545
545
int_data.is_strict = is_strict;
546
546
int_data.is_eval_code = is_eval_code;
547
+ int_data.is_call_in_direct_eval_form = false ;
547
548
int_data.min_reg_num = min_reg_num;
548
549
int_data.max_reg_num = max_reg_num;
549
550
int_data.tmp_num_p = ecma_alloc_number ();
@@ -603,6 +604,49 @@ vm_get_scope_flags (const opcode_t *opcodes_p, /**< byte-code array */
603
604
return (opcode_scope_code_flags_t ) flags_opcode.data .meta .data_1 ;
604
605
} /* vm_get_scope_flags */
605
606
607
+ /* *
608
+ * Check whether currently executed code is strict mode code
609
+ *
610
+ * @return true - current code is executed in strict mode,
611
+ * false - otherwise.
612
+ */
613
+ bool
614
+ vm_is_strict_mode (void )
615
+ {
616
+ JERRY_ASSERT (vm_top_context_p != NULL );
617
+
618
+ return vm_top_context_p->is_strict ;
619
+ } /* vm_is_strict_mode */
620
+
621
+ /* *
622
+ * Check whether currently performed call (on top of call-stack) is performed in form,
623
+ * meeting conditions of 'Direct Call to Eval' (see also: ECMA-262 v5, 15.1.2.1.1)
624
+ *
625
+ * Warning:
626
+ * the function should only be called from implementation
627
+ * of built-in 'eval' routine of Global object
628
+ *
629
+ * @return true - currently performed call is performed through 'eval' identifier,
630
+ * without 'this' argument,
631
+ * false - otherwise.
632
+ */
633
+ bool
634
+ vm_is_direct_eval_form_call (void )
635
+ {
636
+ if (vm_top_context_p != NULL )
637
+ {
638
+ return vm_top_context_p->is_call_in_direct_eval_form ;
639
+ }
640
+ else
641
+ {
642
+ /*
643
+ * There is no any interpreter context, so call is performed not from a script.
644
+ * This implies that the call is indirect.
645
+ */
646
+ return false ;
647
+ }
648
+ } /* vm_is_direct_eval_form_call */
649
+
606
650
/* *
607
651
* Get this binding of current execution context
608
652
*
0 commit comments