Switching get_variable_value to returning value through ecma-stack (stack convention).

This commit is contained in:
Ruben Ayrapetyan
2015-01-14 20:09:24 +03:00
parent e70626f92d
commit e570d18936
14 changed files with 609 additions and 368 deletions
+19 -1
View File
@@ -70,6 +70,10 @@ ecma_stack_add_frame (ecma_stack_frame_t *frame_p) /**< frame to initialize */
frame_p->top_chunk_p = NULL;
frame_p->dynamically_allocated_value_slots_p = frame_p->inlined_values;
frame_p->current_slot_index = 0;
#ifndef JERRY_NDEBUG
frame_p->items_number = 0;
#endif /* !JERRY_NDEBUG */
} /* ecma_stack_add_frame */
/**
@@ -134,6 +138,10 @@ void
ecma_stack_push_value (ecma_stack_frame_t *frame_p, /**< ecma-stack frame */
ecma_value_t value) /**< ecma-value */
{
#ifndef JERRY_NDEBUG
frame_p->items_number++;
#endif /* !JERRY_NDEBUG */
frame_p->current_slot_index++;
if (frame_p->current_slot_index >= JERRY_MIN (ECMA_STACK_FRAME_INLINED_VALUES_NUMBER,
@@ -150,9 +158,13 @@ ecma_stack_push_value (ecma_stack_frame_t *frame_p, /**< ecma-stack frame */
/**
* Get top value from ecma-stack
*/
inline ecma_value_t __attribute_always_inline__
ecma_value_t
ecma_stack_top_value (ecma_stack_frame_t *frame_p) /**< ecma-stack frame */
{
#ifndef JERRY_NDEBUG
JERRY_ASSERT (frame_p->items_number > 0);
#endif /* !JERRY_NDEBUG */
const size_t slots_in_top_chunk = ecma_stack_slots_in_top_chunk (frame_p);
JERRY_ASSERT (frame_p->current_slot_index < slots_in_top_chunk);
@@ -205,6 +217,12 @@ ecma_stack_pop (ecma_stack_frame_t *frame_p) /**< ecma-stack frame */
frame_p->current_slot_index--;
}
#ifndef JERRY_NDEBUG
JERRY_ASSERT (frame_p->items_number > 0);
frame_p->items_number--;
#endif /* !JERRY_NDEBUG */
ecma_free_value (value, true);
} /* ecma_stack_pop */