Support ECMAScript stopping in JerryScript. (#1753)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -618,6 +618,9 @@ bool jerry_is_feature_enabled (const jerry_feature_t feature)
|
||||
#ifdef JERRY_DEBUGGER
|
||||
|| feature == JERRY_FEATURE_DEBUGGER
|
||||
#endif /* JERRY_DEBUGGER */
|
||||
#ifdef JERRY_VM_EXEC_STOP
|
||||
|| feature == JERRY_FEATURE_VM_EXEC_STOP
|
||||
#endif /* JERRY_VM_EXEC_STOP */
|
||||
);
|
||||
} /* jerry_is_feature_enabled */
|
||||
|
||||
@@ -2145,6 +2148,33 @@ jerry_is_valid_cesu8_string (const jerry_char_t *cesu8_buf_p, /**< CESU-8 string
|
||||
(lit_utf8_size_t) buf_size);
|
||||
} /* jerry_is_valid_cesu8_string */
|
||||
|
||||
/**
|
||||
* If JERRY_VM_EXEC_STOP is defined the callback passed to this function is
|
||||
* periodically called with the user_p argument. If frequency is greater
|
||||
* than 1, the callback is only called at every frequency ticks.
|
||||
*/
|
||||
void
|
||||
jerry_set_vm_exec_stop_callback (jerry_vm_exec_stop_callback_t stop_cb, /**< periodically called user function */
|
||||
void *user_p, /**< pointer passed to the function */
|
||||
uint32_t frequency) /**< frequency of the function call */
|
||||
{
|
||||
#ifdef JERRY_VM_EXEC_STOP
|
||||
if (frequency == 0)
|
||||
{
|
||||
frequency = 1;
|
||||
}
|
||||
|
||||
JERRY_CONTEXT (vm_exec_stop_frequency) = frequency;
|
||||
JERRY_CONTEXT (vm_exec_stop_counter) = frequency;
|
||||
JERRY_CONTEXT (vm_exec_stop_user_p) = user_p;
|
||||
JERRY_CONTEXT (vm_exec_stop_cb) = stop_cb;
|
||||
#else /* !JERRY_VM_EXEC_STOP */
|
||||
JERRY_UNUSED (stop_cb);
|
||||
JERRY_UNUSED (user_p);
|
||||
JERRY_UNUSED (frequency);
|
||||
#endif /* JERRY_VM_EXEC_STOP */
|
||||
} /* jerry_set_vm_exec_stop_callback */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user