Move all remaining globals to the global context.
Zero out all globals (and remove unnecessary init() functions). Move snapshot globals to a temporary stack variable. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
+13
-22
@@ -31,6 +31,7 @@
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-regexp-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jcontext.h"
|
||||
#include "opcodes.h"
|
||||
#include "vm.h"
|
||||
#include "vm-stack.h"
|
||||
@@ -44,16 +45,6 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Top (current) interpreter context
|
||||
*/
|
||||
static vm_frame_ctx_t *vm_top_context_p = NULL;
|
||||
|
||||
/**
|
||||
* Direct call from eval;
|
||||
*/
|
||||
static bool is_direct_eval_form_call = false;
|
||||
|
||||
/**
|
||||
* Get the value of object[property].
|
||||
*
|
||||
@@ -240,8 +231,8 @@ vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
|
||||
/* ECMA-262 v5, 10.4.2 */
|
||||
if (is_direct)
|
||||
{
|
||||
this_binding = ecma_copy_value (vm_top_context_p->this_binding);
|
||||
lex_env_p = vm_top_context_p->lex_env_p;
|
||||
this_binding = ecma_copy_value (JERRY_CONTEXT (vm_top_context_p)->this_binding);
|
||||
lex_env_p = JERRY_CONTEXT (vm_top_context_p)->lex_env_p;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -394,7 +385,7 @@ opfunc_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
arguments_list_len);
|
||||
}
|
||||
|
||||
is_direct_eval_form_call = false;
|
||||
JERRY_CONTEXT (is_direct_eval_form_call) = false;
|
||||
|
||||
/* Free registers. */
|
||||
for (uint32_t i = 0; i < arguments_list_len; i++)
|
||||
@@ -1346,7 +1337,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
|
||||
}
|
||||
case VM_OC_EVAL:
|
||||
{
|
||||
is_direct_eval_form_call = true;
|
||||
JERRY_CONTEXT (is_direct_eval_form_call) = true;
|
||||
JERRY_ASSERT (*byte_code_p >= CBC_CALL && *byte_code_p <= CBC_CALL2_PROP_BLOCK);
|
||||
continue;
|
||||
}
|
||||
@@ -2574,10 +2565,10 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
}
|
||||
}
|
||||
|
||||
is_direct_eval_form_call = false;
|
||||
JERRY_CONTEXT (is_direct_eval_form_call) = false;
|
||||
|
||||
prev_context_p = vm_top_context_p;
|
||||
vm_top_context_p = frame_ctx_p;
|
||||
prev_context_p = JERRY_CONTEXT (vm_top_context_p);
|
||||
JERRY_CONTEXT (vm_top_context_p) = frame_ctx_p;
|
||||
|
||||
completion_value = vm_init_loop (frame_ctx_p);
|
||||
|
||||
@@ -2610,7 +2601,7 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
|
||||
ecma_fast_free_value (frame_ctx_p->registers_p[i]);
|
||||
}
|
||||
|
||||
vm_top_context_p = prev_context_p;
|
||||
JERRY_CONTEXT (vm_top_context_p) = prev_context_p;
|
||||
return completion_value;
|
||||
} /* vm_execute */
|
||||
|
||||
@@ -2724,9 +2715,9 @@ vm_run (const ecma_compiled_code_t *bytecode_header_p, /**< byte-code data heade
|
||||
bool
|
||||
vm_is_strict_mode (void)
|
||||
{
|
||||
JERRY_ASSERT (vm_top_context_p != NULL);
|
||||
JERRY_ASSERT (JERRY_CONTEXT (vm_top_context_p) != NULL);
|
||||
|
||||
return vm_top_context_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE;
|
||||
return JERRY_CONTEXT (vm_top_context_p)->bytecode_header_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE;
|
||||
} /* vm_is_strict_mode */
|
||||
|
||||
/**
|
||||
@@ -2741,10 +2732,10 @@ vm_is_strict_mode (void)
|
||||
* without 'this' argument,
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
inline bool __attr_always_inline___
|
||||
vm_is_direct_eval_form_call (void)
|
||||
{
|
||||
return is_direct_eval_form_call;
|
||||
return JERRY_CONTEXT (is_direct_eval_form_call);
|
||||
} /* vm_is_direct_eval_form_call */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user