Rework the engine's internal recursion limit (#2969)
This patch unifies the recursion limit checking for RegExp, function call and JSON as well. Until now the limit was only a counter which was increased/decreased at certain points. This counter has been substituted with a numeric limit which allows to restrict the stack usage. This patch fixes #2963 and resolves the closed #2258 issue. Co-authored-by: Gabor Loki loki@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
@@ -1599,6 +1599,21 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
|
||||
((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);
|
||||
} /* ecma_bytecode_deref */
|
||||
|
||||
#if (JERRY_STACK_LIMIT != 0)
|
||||
/**
|
||||
* Check the current stack usage by calculating the difference from the initial stack base.
|
||||
*
|
||||
* @return current stack usage in bytes
|
||||
*/
|
||||
uintptr_t JERRY_ATTR_NOINLINE
|
||||
ecma_get_current_stack_usage (void)
|
||||
{
|
||||
volatile int __sp;
|
||||
return (uintptr_t) (JERRY_CONTEXT (stack_base) - (uintptr_t)&__sp);
|
||||
} /* ecma_get_current_stack_usage */
|
||||
|
||||
#endif /* (JERRY_STACK_LIMIT != 0) */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user