Reduce try context stack consumption to 1 from 2. (#3898)

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-06-17 14:39:53 +02:00
committed by GitHub
parent 5bcb78482a
commit 8e010146a9
5 changed files with 64 additions and 31 deletions
+10 -2
View File
@@ -189,7 +189,9 @@
/* Stack consumption of opcodes with context. */
/* PARSER_TRY_CONTEXT_STACK_ALLOCATION must be <= 3 */
#define PARSER_TRY_CONTEXT_STACK_ALLOCATION 2
#define PARSER_TRY_CONTEXT_STACK_ALLOCATION 1
/* PARSER_FINALLY_CONTEXT_STACK_ALLOCATION must be <= 3 */
#define PARSER_FINALLY_CONTEXT_STACK_ALLOCATION 2
/* PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION must be <= 4 */
#define PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION 4
/* PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION must be <= 3 */
@@ -199,6 +201,12 @@
/* PARSER_BLOCK_CONTEXT_STACK_ALLOCATION must be <= 3 */
#define PARSER_BLOCK_CONTEXT_STACK_ALLOCATION 1
/**
* Extra stack consumption for finally context.
*/
#define PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION \
(PARSER_FINALLY_CONTEXT_STACK_ALLOCATION - PARSER_TRY_CONTEXT_STACK_ALLOCATION)
/**
* Opcode definitions.
*/
@@ -552,7 +560,7 @@
VM_OC_CATCH) \
CBC_OPCODE (CBC_EXT_RESOLVE_BASE, CBC_NO_FLAG, 0, \
VM_OC_RESOLVE_BASE_FOR_CALL) \
CBC_FORWARD_BRANCH (CBC_EXT_FINALLY, 0, \
CBC_FORWARD_BRANCH (CBC_EXT_FINALLY, PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION, \
VM_OC_FINALLY) \
CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_PROP, CBC_NO_FLAG, 0, \
VM_OC_INITIALIZER_PUSH_PROP | VM_OC_GET_STACK) \