Skip to content

Commit 101f62c

Browse files
rerobikaLaszloLango
authored andcommitted
Improve the vm_loop suspending for exec operations (#2589)
Exec operations{call, construct, super_call} related bytecode sequences no longer executed twice. The execution continues with the next opcode or a specific bytecode sequence if an error occurs during the operation. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent 79b2df1 commit 101f62c

File tree

5 files changed

+163
-158
lines changed

5 files changed

+163
-158
lines changed

jerry-core/jcontext/jcontext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,8 @@ struct jerry_context_t
139139
jerry_debugger_transport_header_t *debugger_transport_header_p; /**< head of transport protocol chain */
140140
uint8_t *debugger_send_buffer_payload_p; /**< start where the outgoing message can be written */
141141
vm_frame_ctx_t *debugger_stop_context; /**< stop only if the current context is equal to this context */
142+
uint8_t *debugger_exception_byte_code_p; /**< Location of the currently executed byte code if an
143+
* error occours while the vm_loop is suspended */
142144
jmem_cpointer_t debugger_byte_code_free_head; /**< head of byte code free linked list */
143145
jmem_cpointer_t debugger_byte_code_free_tail; /**< tail of byte code free linked list */
144146
uint32_t debugger_flags; /**< debugger flags */

jerry-core/parser/js/byte-code.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,8 @@
626626
VM_OC_SUPER_PROP_REFERENCE) \
627627
CBC_OPCODE (CBC_EXT_CONSTRUCTOR_RETURN, CBC_NO_FLAG, -1, \
628628
VM_OC_CONSTRUCTOR_RET | VM_OC_GET_STACK) \
629+
CBC_OPCODE (CBC_EXT_ERROR, CBC_NO_FLAG, 0, \
630+
VM_OC_ERROR) \
629631
\
630632
/* Binary compound assignment opcodes with pushing the result. */ \
631633
CBC_EXT_BINARY_LVALUE_OPERATION (CBC_EXT_ASSIGN_ADD, \

jerry-core/vm/vm-defines.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ typedef struct vm_frame_ctx_t
5454
ecma_object_t *lex_env_p; /**< current lexical environment */
5555
struct vm_frame_ctx_t *prev_context_p; /**< previous context */
5656
ecma_value_t this_binding; /**< this binding */
57-
ecma_value_t call_block_result; /**< preserve block result during a call */
57+
ecma_value_t block_result; /**< block result */
5858
#ifdef JERRY_ENABLE_LINE_INFO
5959
ecma_value_t resource_name; /**< current resource name (usually a file name) */
6060
uint32_t current_line; /**< currently executed line */

0 commit comments

Comments
 (0)