Implement the core of the generator functions. (#3368)
Some things are missing: - yield* support - generator definition in object literal - the hidden GeneratorFunction JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
committed by
Dániel Bátyai
parent
14e95a4775
commit
110f75c99d
@@ -188,18 +188,18 @@
|
||||
|
||||
/* Stack consumption of opcodes with context. */
|
||||
|
||||
/* PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION must be <= 3 */
|
||||
#define PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION 3
|
||||
/* PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION must be <= 4 */
|
||||
#define PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION 4
|
||||
/* PARSER_BLOCK_CONTEXT_STACK_ALLOCATION must be <= 3 */
|
||||
#define PARSER_BLOCK_CONTEXT_STACK_ALLOCATION 1
|
||||
/* PARSER_WITH_CONTEXT_STACK_ALLOCATION must be <= 4 */
|
||||
#define PARSER_WITH_CONTEXT_STACK_ALLOCATION 1
|
||||
/* PARSER_SUPER_CLASS_CONTEXT_STACK_ALLOCATION must be <= 4 */
|
||||
#define PARSER_SUPER_CLASS_CONTEXT_STACK_ALLOCATION 1
|
||||
/* PARSER_TRY_CONTEXT_STACK_ALLOCATION must be <= 3 */
|
||||
#define PARSER_TRY_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 */
|
||||
#define PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION 3
|
||||
/* PARSER_BLOCK_CONTEXT_STACK_ALLOCATION must be <= 3 */
|
||||
#define PARSER_WITH_CONTEXT_STACK_ALLOCATION 1
|
||||
/* PARSER_SUPER_CLASS_CONTEXT_STACK_ALLOCATION must be <= 4 */
|
||||
#define PARSER_BLOCK_CONTEXT_STACK_ALLOCATION 1
|
||||
/* PARSER_WITH_CONTEXT_STACK_ALLOCATION must be <= 4 */
|
||||
#define PARSER_SUPER_CLASS_CONTEXT_STACK_ALLOCATION 1
|
||||
|
||||
/**
|
||||
* Opcode definitions.
|
||||
@@ -654,6 +654,12 @@
|
||||
VM_OC_INITIALIZER_PUSH_PROP | VM_OC_GET_LITERAL) \
|
||||
CBC_OPCODE (CBC_EXT_SPREAD_NEW, CBC_HAS_POP_STACK_BYTE_ARG, 0, \
|
||||
VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK) \
|
||||
CBC_OPCODE (CBC_EXT_CREATE_GENERATOR, CBC_NO_FLAG, 0, \
|
||||
VM_OC_CREATE_GENERATOR) \
|
||||
CBC_OPCODE (CBC_EXT_YIELD, CBC_NO_FLAG, -1, \
|
||||
VM_OC_YIELD | VM_OC_GET_STACK) \
|
||||
CBC_OPCODE (CBC_EXT_CONTINUE_EXEC, CBC_NO_FLAG, 1, \
|
||||
VM_OC_CONTINUE_EXEC) \
|
||||
\
|
||||
/* Last opcode (not a real opcode). */ \
|
||||
CBC_OPCODE (CBC_EXT_END, CBC_NO_FLAG, 0, \
|
||||
@@ -743,7 +749,8 @@ typedef enum
|
||||
CBC_CODE_FLAGS_STATIC_FUNCTION = (1u << 8), /**< this function is a static snapshot function */
|
||||
CBC_CODE_FLAGS_DEBUGGER_IGNORE = (1u << 9), /**< this function should be ignored by debugger */
|
||||
CBC_CODE_FLAGS_CONSTRUCTOR = (1u << 10), /**< this function is a constructor */
|
||||
CBC_CODE_FLAGS_REST_PARAMETER = (1u << 11), /**< this function has rest parameter */
|
||||
CBC_CODE_FLAGS_GENERATOR = (1u << 11), /**< this function is a generator */
|
||||
CBC_CODE_FLAGS_REST_PARAMETER = (1u << 12), /**< this function has rest parameter */
|
||||
} cbc_code_flags;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user