Creating ecma-stack frames in run_int_from_pos.

This commit is contained in:
Ruben Ayrapetyan
2015-01-12 20:52:04 +03:00
parent b843167b91
commit 917ebe4a83
3 changed files with 15 additions and 3 deletions
+8 -1
View File
@@ -1,4 +1,4 @@
/* Copyright 2014 Samsung Electronics Co., Ltd.
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
#include "ecma-helpers.h"
#include "ecma-lex-env.h"
#include "ecma-operations.h"
#include "ecma-stack.h"
#include "globals.h"
#include "interpreter.h"
#include "jerry-libc.h"
@@ -461,6 +462,9 @@ run_int_from_pos (opcode_counter_t start_pos,
__memset (regs, 0, regs_num * sizeof (ecma_value_t));
JERRY_ASSERT (ecma_is_value_empty (regs[0]));
ecma_stack_frame_t frame;
ecma_stack_add_frame (&frame);
int_data_t int_data;
int_data.pos = (opcode_counter_t) (start_pos + 1);
int_data.this_binding = this_binding_value;
@@ -471,6 +475,7 @@ run_int_from_pos (opcode_counter_t start_pos,
int_data.max_reg_num = max_reg_num;
int_data.regs_p = regs;
int_data.tmp_num_p = ecma_alloc_number ();
int_data.stack_frame_p = &frame;
#ifdef MEM_STATS
interp_mem_stats_context_enter (&int_data, start_pos);
@@ -483,6 +488,8 @@ run_int_from_pos (opcode_counter_t start_pos,
|| ecma_is_completion_value_return (completion)
|| ecma_is_completion_value_exit (completion));
ecma_stack_free_frame (&frame);
ecma_dealloc_number (int_data.tmp_num_p);
for (uint32_t reg_index = 0;
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright 2014 Samsung Electronics Co., Ltd.
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@
#define OPCODES_H
#include "ecma-globals.h"
#include "ecma-stack.h"
#include "globals.h"
/* Maximum opcodes number in bytecode. */
@@ -83,6 +84,7 @@ typedef struct
idx_t max_reg_num; /**< maximum idx used for register identification */
ecma_value_t *regs_p; /**< register variables */
ecma_number_t* tmp_num_p; /**< an allocated number (to reduce temporary allocations) */
ecma_stack_frame_t *stack_frame_p; /**< ecma-stack frame associated with the context */
#ifdef MEM_STATS
size_t context_peak_allocated_heap_bytes;
+4 -1
View File
@@ -1,4 +1,4 @@
/* Copyright 2014 Samsung Electronics Co., Ltd.
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@
#include "ecma-gc.h"
#include "ecma-lcache.h"
#include "ecma-operations.h"
#include "ecma-stack.h"
#include "mem-allocator.h"
/** \addtogroup ecma ECMA
@@ -36,6 +37,7 @@ ecma_init (void)
ecma_strings_init ();
ecma_init_builtins ();
ecma_lcache_init ();
ecma_stack_init ();
mem_register_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
} /* ecma_init */
@@ -48,6 +50,7 @@ ecma_finalize (void)
{
mem_unregister_a_try_give_memory_back_callback (ecma_try_to_give_back_some_memory);
ecma_stack_finalize ();
ecma_finalize_builtins ();
ecma_lcache_invalidate_all ();
ecma_gc_run (ECMA_GC_GEN_COUNT - 1);