Compact Byte Code parser and executor for Jerry.
JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com JerryScript-DCO-1.0-Signed-off-by: Tamas Gergely tgergely.u-szeged@partner.samsung.com JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs.u-szeged@partner.samsung.com JerryScript-DCO-1.0-Signed-off-by: István Kádár ikadar@inf.u-szeged.hu JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
+26
-24
@@ -1,4 +1,5 @@
|
||||
/* Copyright 2015 Samsung Electronics Co., Ltd.
|
||||
/* Copyright 2015-2016 Samsung Electronics Co., Ltd.
|
||||
* Copyright 2015-2016 University of Szeged.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -36,7 +37,7 @@
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint16_t prev_chunk_p; /**< previous chunk of same frame */
|
||||
uint16_t prev_chunk_p; /**< previous chunk of same frame */
|
||||
} vm_stack_chunk_header_t;
|
||||
|
||||
/**
|
||||
@@ -44,30 +45,31 @@ typedef struct
|
||||
*/
|
||||
typedef struct vm_stack_frame_t
|
||||
{
|
||||
struct vm_stack_frame_t *prev_frame_p; /**< previous frame */
|
||||
vm_stack_chunk_header_t *top_chunk_p; /**< the top-most chunk of the frame */
|
||||
ecma_value_t *dynamically_allocated_value_slots_p; /**< pointer to dynamically allocated value slots
|
||||
* in the top-most chunk */
|
||||
uint32_t current_slot_index; /**< index of first free slot in the top chunk */
|
||||
ecma_value_t inlined_values[VM_STACK_FRAME_INLINED_VALUES_NUMBER]; /**< place for values inlined into stack frame
|
||||
* (instead of being placed on heap) */
|
||||
ecma_value_t *regs_p; /**< register variables */
|
||||
uint32_t regs_number; /**< number of register variables */
|
||||
struct vm_stack_frame_t *prev_frame_p; /**< previous frame */
|
||||
uint32_t regs_number; /**< number of register variables */
|
||||
} vm_stack_frame_t;
|
||||
|
||||
extern void vm_stack_init (void);
|
||||
extern void vm_stack_finalize (void);
|
||||
extern vm_stack_frame_t *
|
||||
vm_stack_get_top_frame (void);
|
||||
extern void
|
||||
vm_stack_add_frame (vm_stack_frame_t *, ecma_value_t *, uint32_t, uint32_t, uint32_t, ecma_collection_header_t *);
|
||||
extern void vm_stack_free_frame (vm_stack_frame_t *);
|
||||
extern ecma_value_t vm_stack_frame_get_reg_value (vm_stack_frame_t *, uint32_t);
|
||||
extern void vm_stack_frame_set_reg_value (vm_stack_frame_t *, uint32_t, ecma_value_t);
|
||||
extern void vm_stack_push_value (vm_stack_frame_t *, ecma_value_t);
|
||||
extern ecma_value_t vm_stack_top_value (vm_stack_frame_t *);
|
||||
extern void vm_stack_pop (vm_stack_frame_t *);
|
||||
extern void vm_stack_pop_multiple (vm_stack_frame_t *, uint32_t);
|
||||
#define VM_CREATE_CONTEXT(type, end_offset) ((ecma_value_t) ((type) | (end_offset) << 4))
|
||||
#define VM_GET_CONTEXT_TYPE(value) ((vm_stack_context_type_t) ((value) & 0xf))
|
||||
#define VM_GET_CONTEXT_END(value) ((value) >> 4)
|
||||
|
||||
/**
|
||||
* Context types for the vm stack.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
VM_CONTEXT_FINALLY_JUMP, /**< finally context with a jump */
|
||||
VM_CONTEXT_FINALLY_THROW, /**< finally context with a throw */
|
||||
VM_CONTEXT_FINALLY_RETURN, /**< finally context with a return */
|
||||
VM_CONTEXT_TRY, /**< try context */
|
||||
VM_CONTEXT_CATCH, /**< catch context */
|
||||
VM_CONTEXT_WITH, /**< with context */
|
||||
VM_CONTEXT_FOR_IN, /**< for-in context */
|
||||
} vm_stack_context_type_t;
|
||||
|
||||
extern ecma_value_t *vm_stack_context_abort (vm_frame_ctx_t *, ecma_value_t *);
|
||||
extern bool vm_stack_find_finally (vm_frame_ctx_t *, ecma_value_t **,
|
||||
vm_stack_context_type_t, uint32_t);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
Reference in New Issue
Block a user