jscript: Keep reference to bytecode in call_frame_t.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2016-03-28 17:50:18 +02:00 committed by Alexandre Julliard
parent db0fee5e9d
commit 8c1526a865
2 changed files with 4 additions and 2 deletions

View File

@ -2388,6 +2388,7 @@ static void release_call_frame(call_frame_t *frame)
if(frame->scope) if(frame->scope)
scope_release(frame->scope); scope_release(frame->scope);
jsval_release(frame->ret); jsval_release(frame->ret);
release_bytecode(frame->bytecode);
heap_free(frame); heap_free(frame);
} }
@ -2579,7 +2580,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
if(!frame) if(!frame)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
frame->bytecode = bytecode; frame->bytecode = bytecode_addref(bytecode);
frame->function = function; frame->function = function;
frame->ip = function->instr_off; frame->ip = function->instr_off;
frame->stack_base = ctx->stack_top; frame->stack_base = ctx->stack_top;

View File

@ -168,9 +168,10 @@ typedef struct _bytecode_t {
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,const WCHAR*,BOOL,BOOL,bytecode_t**) DECLSPEC_HIDDEN; HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,const WCHAR*,BOOL,BOOL,bytecode_t**) DECLSPEC_HIDDEN;
void release_bytecode(bytecode_t*) DECLSPEC_HIDDEN; void release_bytecode(bytecode_t*) DECLSPEC_HIDDEN;
static inline void bytecode_addref(bytecode_t *code) static inline bytecode_t *bytecode_addref(bytecode_t *code)
{ {
code->ref++; code->ref++;
return code;
} }
typedef struct _scope_chain_t { typedef struct _scope_chain_t {