winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
August 2016
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
2 participants
777 discussions
Start a n
N
ew thread
Jacek Caban : jscript: Store variables on the stack if possible.
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: 765a52e86a65a1c0604b9ef985772195dbe5f67c URL:
http://source.winehq.org/git/wine.git/?a=commit;h=765a52e86a65a1c0604b9ef98…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Aug 4 13:40:11 2016 +0200 jscript: Store variables on the stack if possible. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/jscript/engine.c | 114 +++++++++++++++++++++++++++++++++++++------------- dlls/jscript/engine.h | 2 + 2 files changed, 86 insertions(+), 30 deletions(-) diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 2305998..642705a 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -217,11 +217,16 @@ static BOOL stack_topn_exprval(script_ctx_t *ctx, unsigned n, exprval_t *r) if(!frame->base_scope->frame && off >= frame->arguments_off) { DISPID id; + BSTR name; HRESULT hres; /* Got stack reference in deoptimized code. Need to convert it back to variable object reference. */ - hres = jsdisp_get_id(ctx->call_ctx->base_scope->jsobj, frame->function->params[off - frame->arguments_off], 0, &id); + assert(off < frame->variables_off + frame->function->var_cnt); + name = off >= frame->variables_off + ? frame->function->variables[off - frame->variables_off].name + : frame->function->params[off - frame->arguments_off]; + hres = jsdisp_get_id(ctx->call_ctx->base_scope->jsobj, name, 0, &id); if(FAILED(hres)) { r->type = EXPRVAL_INVALID; r->u.hres = hres; @@ -541,6 +546,13 @@ static HRESULT equal2_values(jsval_t lval, jsval_t rval, BOOL *ret) return S_OK; } +static inline unsigned local_off(call_frame_t *frame, int ref) +{ + return ref < 0 + ? frame->arguments_off - ref-1 + : frame->variables_off + ref; +} + /* * Transfers local variables from stack to variable object. * It's slow, so we want to avoid it as much as possible. @@ -566,8 +578,9 @@ static HRESULT detach_variable_object(script_ctx_t *ctx, call_frame_t *frame) frame->base_scope->frame = NULL; - for(i = 0; i < frame->function->param_cnt; i++) { - hres = jsdisp_propput_name(frame->variable_obj, frame->function->params[i], ctx->stack[frame->arguments_off+i]); + for(i = 0; i < frame->function->locals_cnt; i++) { + hres = jsdisp_propput_name(frame->variable_obj, frame->function->locals[i].name, + ctx->stack[local_off(frame, frame->function->locals[i].ref)]); if(FAILED(hres)) return hres; } @@ -622,9 +635,10 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re local_ref_t *ref = lookup_local(func, identifier); static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0}; - if(ref && ref->ref < 0) { + if(ref) { ret->type = EXPRVAL_STACK_REF; - ret->u.off = scope->frame->arguments_off - ref->ref - 1; + ret->u.off = local_off(scope->frame, ref->ref); + TRACE("returning ref %d for %d\n", ret->u.off, ref->ref); return S_OK; } @@ -2532,20 +2546,24 @@ static void pop_call_frame(script_ctx_t *ctx) { call_frame_t *frame = ctx->call_ctx; + frame->stack_base -= frame->pop_locals + frame->pop_variables; + + assert(frame->scope == frame->base_scope); + + /* If current scope will be kept alive, we need to transfer local variables to its variable object. */ + if(frame->scope && frame->scope->ref > 1) { + HRESULT hres = detach_variable_object(ctx, frame); + if(FAILED(hres)) + ERR("Failed to detach variable object: %08x\n", hres); + } + if(frame->arguments_obj) detach_arguments_object(frame->arguments_obj); - - if(frame->scope) { - /* If current scope will be kept alive, we need to transfer local variables to its variable object. */ - if(frame->scope->ref > 1) { - HRESULT hres = detach_variable_object(ctx, frame); - if(FAILED(hres)) - ERR("Failed to detach variable object: %08x\n", hres); - } + if(frame->scope) scope_release(frame->scope); - } - frame->stack_base -= frame->pop_locals; + if(frame->pop_variables) + stack_popn(ctx, frame->pop_variables); stack_popn(ctx, frame->pop_locals); ctx->call_ctx = frame->prev_frame; @@ -2738,6 +2756,36 @@ static HRESULT setup_scope(script_ctx_t *ctx, call_frame_t *frame, unsigned argc } frame->pop_locals = ctx->stack_top - orig_stack; + + frame->variables_off = ctx->stack_top; + + for(i = 0; i < frame->function->var_cnt; i++) { + hres = stack_push(ctx, jsval_undefined()); + if(FAILED(hres)) { + stack_popn(ctx, ctx->stack_top - orig_stack); + return hres; + } + } + + frame->pop_variables = i; + + for(i = 0; i < frame->function->func_cnt; i++) { + if(frame->function->funcs[i].name && !frame->function->funcs[i].event_target) { + jsdisp_t *func_obj; + unsigned off; + + hres = create_source_function(ctx, frame->bytecode, frame->function->funcs+i, frame->base_scope, &func_obj); + if(FAILED(hres)) { + stack_popn(ctx, ctx->stack_top - orig_stack); + return hres; + } + + off = local_off(frame, frame->function->funcs[i].local_ref); + jsval_release(ctx->stack[off]); + ctx->stack[off] = jsval_obj(func_obj); + } + } + frame->base_scope->frame = frame; return S_OK; } @@ -2752,33 +2800,38 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi for(i = 0; i < function->func_cnt; i++) { jsdisp_t *func_obj; - if(!function->funcs[i].name) + if(!function->funcs[i].event_target) continue; hres = create_source_function(ctx, bytecode, function->funcs+i, scope, &func_obj); if(FAILED(hres)) return hres; - if(function->funcs[i].event_target) - hres = bind_event_target(ctx, function->funcs+i, func_obj); - else - hres = jsdisp_propput_name(variable_obj, function->funcs[i].name, jsval_obj(func_obj)); + hres = bind_event_target(ctx, function->funcs+i, func_obj); jsdisp_release(func_obj); if(FAILED(hres)) return hres; } - for(i=0; i < function->var_cnt; i++) { - TRACE("[%d] %s %d\n", i, debugstr_w(function->variables[i].name), function->variables[i].func_id); - if(function->variables[i].func_id != -1) - continue; + if(flags & (EXEC_GLOBAL | EXEC_EVAL)) { + for(i=0; i < function->var_cnt; i++) { + TRACE("[%d] %s %d\n", i, debugstr_w(function->variables[i].name), function->variables[i].func_id); + if(function->variables[i].func_id != -1) { + jsdisp_t *func_obj; - if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, function->variables[i].name, NULL)) { - DISPID id = 0; + hres = create_source_function(ctx, bytecode, function->funcs+function->variables[i].func_id, scope, &func_obj); + if(FAILED(hres)) + return hres; - hres = jsdisp_get_id(variable_obj, function->variables[i].name, fdexNameEnsure, &id); - if(FAILED(hres)) - return hres; + hres = jsdisp_propput_name(variable_obj, function->variables[i].name, jsval_obj(func_obj)); + jsdisp_release(func_obj); + }else if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, function->variables[i].name, NULL)) { + DISPID id = 0; + + hres = jsdisp_get_id(variable_obj, function->variables[i].name, fdexNameEnsure, &id); + if(FAILED(hres)) + return hres; + } } } @@ -2807,6 +2860,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi frame->function = function; frame->ret = jsval_undefined(); frame->argc = argc; + frame->bytecode = bytecode_addref(bytecode); if(scope) { frame->base_scope = frame->scope = scope_addref(scope); @@ -2814,13 +2868,13 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi if(!(flags & (EXEC_GLOBAL|EXEC_EVAL))) { hres = setup_scope(ctx, frame, argc, argv); if(FAILED(hres)) { + release_bytecode(frame->bytecode); heap_free(frame); return hres; } } } - frame->bytecode = bytecode_addref(bytecode); frame->ip = function->instr_off; frame->stack_base = ctx->stack_top; if(this_obj) diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 2aaf831..b18b775 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -225,6 +225,8 @@ typedef struct _call_frame_t { unsigned argc; unsigned pop_locals; unsigned arguments_off; + unsigned variables_off; + unsigned pop_variables; bytecode_t *bytecode; function_code_t *function;
1
0
0
0
Jacek Caban : jscript: Don't use OP_var_set.
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: 7694afff4bb33b25fd5899d07ffce4f31d12474f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=7694afff4bb33b25fd5899d07…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Aug 4 13:39:53 2016 +0200 jscript: Don't use OP_var_set. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/jscript/compile.c | 9 ++++++++- dlls/jscript/engine.c | 15 --------------- dlls/jscript/engine.h | 1 - 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c index e911373..0087459 100644 --- a/dlls/jscript/compile.c +++ b/dlls/jscript/compile.c @@ -1095,11 +1095,18 @@ static HRESULT compile_variable_list(compiler_ctx_t *ctx, variable_declaration_t if(!iter->expr) continue; + hres = push_instr_bstr_uint(ctx, OP_identid, iter->identifier, 0); + if(FAILED(hres)) + return hres; + hres = compile_expression(ctx, iter->expr, TRUE); if(FAILED(hres)) return hres; - hres = push_instr_bstr(ctx, OP_var_set, iter->identifier); + if(!push_instr(ctx, OP_assign)) + return E_OUTOFMEMORY; + + hres = push_instr_uint(ctx, OP_pop, 1); if(FAILED(hres)) return hres; } diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index bc8eb5b..2305998 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -728,21 +728,6 @@ static inline void jmp_abs(script_ctx_t *ctx, unsigned dst) ctx->call_ctx->ip = dst; } -/* ECMA-262 3rd Edition 12.2 */ -static HRESULT interp_var_set(script_ctx_t *ctx) -{ - const BSTR name = get_op_bstr(ctx, 0); - jsval_t val; - HRESULT hres; - - TRACE("%s\n", debugstr_w(name)); - - val = stack_pop(ctx); - hres = jsdisp_propput_name(ctx->call_ctx->variable_obj, name, val); - jsval_release(val); - return hres; -} - /* ECMA-262 3rd Edition 12.6.4 */ static HRESULT interp_forin(script_ctx_t *ctx) { diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 0434ff1..2aaf831 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -89,7 +89,6 @@ X(setret, 1, 0,0) \ X(sub, 1, 0,0) \ X(undefined, 1, 0,0) \ - X(var_set, 1, ARG_BSTR, 0) \ X(void, 1, 0,0) \ X(xor, 1, 0,0)
1
0
0
0
Jacek Caban : jscript: Store local functions in locals map.
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: 713051d027cd554cdc3a3ead077245b1ac3ca514 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=713051d027cd554cdc3a3ead0…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Aug 4 13:39:46 2016 +0200 jscript: Store local functions in locals map. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/jscript/compile.c | 74 +++++++++++++++++++++++++++--------------------- dlls/jscript/engine.c | 15 ++++++++-- dlls/jscript/engine.h | 8 +++++- dlls/jscript/function.c | 2 +- dlls/jscript/tests/run.c | 2 ++ 5 files changed, 64 insertions(+), 37 deletions(-) diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c index 4dea4c7..e911373 100644 --- a/dlls/jscript/compile.c +++ b/dlls/jscript/compile.c @@ -1825,10 +1825,12 @@ static BOOL alloc_variable(compiler_ctx_t *ctx, const WCHAR *name) return alloc_local(ctx, ident, ctx->func->var_cnt++); } -static void visit_function_expression(compiler_ctx_t *ctx, function_expression_t *expr) +static BOOL visit_function_expression(compiler_ctx_t *ctx, function_expression_t *expr) { expr->func_id = ctx->func->func_cnt++; ctx->func_tail = ctx->func_tail ? (ctx->func_tail->next = expr) : (ctx->func_head = expr); + + return !expr->identifier || expr->event_target || alloc_variable(ctx, expr->identifier); } static HRESULT visit_expression(compiler_ctx_t *ctx, expression_t *expr) @@ -2234,6 +2236,18 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source, if(func_expr) { parameter_t *param_iter; + if(func_expr->identifier) { + func->name = compiler_alloc_bstr(ctx, func_expr->identifier); + if(!func->name) + return E_OUTOFMEMORY; + } + + if(func_expr->event_target) { + func->event_target = compiler_alloc_bstr(ctx, func_expr->event_target); + if(!func->event_target) + return E_OUTOFMEMORY; + } + func->source = func_expr->src_str; func->source_len = func_expr->src_len; @@ -2260,36 +2274,6 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source, if(FAILED(hres)) return hres; - off = ctx->code_off; - hres = compile_block_statement(ctx, source->statement); - if(FAILED(hres)) - return hres; - - resolve_labels(ctx, off); - - hres = push_instr_uint(ctx, OP_ret, !from_eval); - if(FAILED(hres)) - return hres; - - if(TRACE_ON(jscript_disas)) - dump_code(ctx, off); - - func->instr_off = off; - - if(func_expr) { - if(func_expr->identifier) { - func->name = compiler_alloc_bstr(ctx, func_expr->identifier); - if(!func->name) - return E_OUTOFMEMORY; - } - - if(func_expr->event_target) { - func->event_target = compiler_alloc_bstr(ctx, func_expr->event_target); - if(!func->event_target) - return E_OUTOFMEMORY; - } - } - func->locals = compiler_alloc(ctx->code, ctx->locals_cnt * sizeof(*func->locals)); if(!func->locals) return E_OUTOFMEMORY; @@ -2303,7 +2287,8 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source, for(i = 0, j = 0; i < func->locals_cnt; i++) { if(func->locals[i].ref < 0) continue; /* skip arguments */ - func->variables[func->locals[i].ref] = func->locals[i].name; + func->variables[func->locals[i].ref].name = func->locals[i].name; + func->variables[func->locals[i].ref].func_id = -1; j++; } @@ -2314,10 +2299,35 @@ static HRESULT compile_function(compiler_ctx_t *ctx, source_elements_t *source, return E_OUTOFMEMORY; memset(func->funcs, 0, func->func_cnt * sizeof(*func->funcs)); + off = ctx->code_off; + hres = compile_block_statement(ctx, source->statement); + if(FAILED(hres)) + return hres; + + resolve_labels(ctx, off); + + hres = push_instr_uint(ctx, OP_ret, !from_eval); + if(FAILED(hres)) + return hres; + + if(TRACE_ON(jscript_disas)) + dump_code(ctx, off); + + func->instr_off = off; + for(iter = ctx->func_head, i=0; iter; iter = iter->next, i++) { hres = compile_function(ctx, iter->source_elements, iter, FALSE, func->funcs+i); if(FAILED(hres)) return hres; + + TRACE("[%d] func %s\n", i, debugstr_w(func->funcs[i].name)); + if(func->funcs[i].name && !func->funcs[i].event_target) { + local_ref_t *local_ref = lookup_local(func, func->funcs[i].name); + func->funcs[i].local_ref = local_ref->ref; + TRACE("found ref %s %d for %s\n", debugstr_w(local_ref->name), local_ref->ref, debugstr_w(func->funcs[i].name)); + if(local_ref->ref >= 0) + func->variables[local_ref->ref].func_id = i; + } } assert(i == func->func_cnt); diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 7861b77..bc8eb5b 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -600,6 +600,11 @@ static int local_ref_cmp(const void *key, const void *ref) return strcmpW((const WCHAR*)key, ((const local_ref_t*)ref)->name); } +local_ref_t *lookup_local(const function_code_t *function, const WCHAR *identifier) +{ + return bsearch(identifier, function->locals, function->locals_cnt, sizeof(*function->locals), local_ref_cmp); +} + /* ECMA-262 3rd Edition 10.1.4 */ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *ret) { @@ -614,7 +619,7 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re for(scope = ctx->call_ctx->scope; scope; scope = scope->next) { if(scope->frame) { function_code_t *func = scope->frame->function; - local_ref_t *ref = bsearch(identifier, func->locals, func->locals_cnt, sizeof(*func->locals), local_ref_cmp); + local_ref_t *ref = lookup_local(func, identifier); static const WCHAR argumentsW[] = {'a','r','g','u','m','e','n','t','s',0}; if(ref && ref->ref < 0) { @@ -2779,10 +2784,14 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi } for(i=0; i < function->var_cnt; i++) { - if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, function->variables[i], NULL)) { + TRACE("[%d] %s %d\n", i, debugstr_w(function->variables[i].name), function->variables[i].func_id); + if(function->variables[i].func_id != -1) + continue; + + if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, function->variables[i].name, NULL)) { DISPID id = 0; - hres = jsdisp_get_id(variable_obj, function->variables[i], fdexNameEnsure, &id); + hres = jsdisp_get_id(variable_obj, function->variables[i].name, fdexNameEnsure, &id); if(FAILED(hres)) return hres; } diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 81be179..0434ff1 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -133,6 +133,7 @@ typedef struct { typedef struct _function_code_t { BSTR name; + int local_ref; BSTR event_target; unsigned instr_off; @@ -143,7 +144,10 @@ typedef struct _function_code_t { struct _function_code_t *funcs; unsigned var_cnt; - BSTR *variables; + struct { + BSTR name; + int func_id; /* -1 if not a function */ + } *variables; unsigned param_cnt; BSTR *params; @@ -152,6 +156,8 @@ typedef struct _function_code_t { local_ref_t *locals; } function_code_t; +local_ref_t *lookup_local(const function_code_t*,const WCHAR*) DECLSPEC_HIDDEN; + typedef struct _bytecode_t { LONG ref; diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index 2475908..704d2ef 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -813,7 +813,7 @@ static HRESULT construct_function(script_ctx_t *ctx, unsigned argc, jsval_t *arg if(FAILED(hres)) return hres; - if(code->global_code.func_cnt != 1 || code->global_code.var_cnt) { + if(code->global_code.func_cnt != 1 || code->global_code.var_cnt != 1) { ERR("Invalid parser result!\n"); release_bytecode(code); return E_UNEXPECTED; diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 0101f15..ff6edce 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -2530,6 +2530,8 @@ static BOOL run_tests(void) parse_script_a("eval('var testPropGet;');"); CHECK_CALLED(global_propget_d); + parse_script_a("var testPropGet; function testPropGet() {}"); + SET_EXPECT(global_notexists_d); parse_script_a("var notExists; notExists = 1;"); CHECK_CALLED(global_notexists_d);
1
0
0
0
Jacek Caban : jscript: Use locals map for local variables.
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: 2e06686ef9f9c95caacd3119abc06c6c211fd776 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2e06686ef9f9c95caacd3119a…
Author: Jacek Caban <jacek(a)codeweavers.com> Date: Thu Aug 4 13:39:36 2016 +0200 jscript: Use locals map for local variables. Signed-off-by: Jacek Caban <jacek(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/jscript/compile.c | 395 +++++++++++++++++++++++++++++++++++++++++++++---- dlls/jscript/engine.c | 2 +- dlls/jscript/parser.h | 1 + 3 files changed, 366 insertions(+), 32 deletions(-) Diff:
http://source.winehq.org/git/wine.git/?a=commitdiff;h=2e06686ef9f9c95caacd3…
1
0
0
0
Sebastian Lackner : xaudio2_7: Only declare debug channel when needed.
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: 2fc672098850d22fd08d61e0340e4f9ef2504ea0 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2fc672098850d22fd08d61e03…
Author: Sebastian Lackner <sebastian(a)fds-team.de> Date: Sun Jul 31 20:01:04 2016 +0200 xaudio2_7: Only declare debug channel when needed. Signed-off-by: Sebastian Lackner <sebastian(a)fds-team.de> Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/xaudio2_7/compat.c | 2 ++ dlls/xaudio2_7/x3daudio.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/dlls/xaudio2_7/compat.c b/dlls/xaudio2_7/compat.c index 516d6c2..b9e720f 100644 --- a/dlls/xaudio2_7/compat.c +++ b/dlls/xaudio2_7/compat.c @@ -101,7 +101,9 @@ #include "wine/debug.h" +#if XAUDIO2_VER <= 7 WINE_DEFAULT_DEBUG_CHANNEL(xaudio2); +#endif /* BEGIN IXAudio2SourceVoice */ #if XAUDIO2_VER == 0 diff --git a/dlls/xaudio2_7/x3daudio.c b/dlls/xaudio2_7/x3daudio.c index a182852..58f7062 100644 --- a/dlls/xaudio2_7/x3daudio.c +++ b/dlls/xaudio2_7/x3daudio.c @@ -23,7 +23,9 @@ #include "wine/debug.h" +#if XAUDIO2_VER >= 8 || defined X3DAUDIO1_VER WINE_DEFAULT_DEBUG_CHANNEL(xaudio2); +#endif #ifdef X3DAUDIO1_VER BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, void *pReserved)
1
0
0
0
Henri Verbeet : wined3d: Use wined3d_texture_load_location() in swapchain_gl_frontbuffer_updated().
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: f80ba28a1552db3d455cb88ed063c87bcc72c58f URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f80ba28a1552db3d455cb88ed…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Aug 4 12:06:59 2016 +0200 wined3d: Use wined3d_texture_load_location() in swapchain_gl_frontbuffer_updated(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/swapchain.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 52f3e71..802e2bc 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -637,12 +637,11 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, static void swapchain_gl_frontbuffer_updated(struct wined3d_swapchain *swapchain) { - struct wined3d_surface *surface; + struct wined3d_texture *front_buffer = swapchain->front_buffer; struct wined3d_context *context; - surface = swapchain->front_buffer->sub_resources[0].u.surface; - context = context_acquire(swapchain->device, surface); - surface_load_location(surface, context, surface->container->resource.draw_binding); + context = context_acquire(swapchain->device, front_buffer->sub_resources[0].u.surface); + wined3d_texture_load_location(front_buffer, 0, context, front_buffer->resource.draw_binding); context_release(context); SetRectEmpty(&swapchain->front_buffer_update); }
1
0
0
0
Henri Verbeet : wined3d: Use wined3d_texture_load_location() in swapchain_gl_present().
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: 398f0d024f49ff2fd0958242b92c1461a0b64f6b URL:
http://source.winehq.org/git/wine.git/?a=commit;h=398f0d024f49ff2fd0958242b…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Aug 4 12:06:58 2016 +0200 wined3d: Use wined3d_texture_load_location() in swapchain_gl_present(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/swapchain.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 13106bf..52f3e71 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -483,14 +483,14 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct static void swapchain_gl_present(struct wined3d_swapchain *swapchain, const RECT *src_rect, const RECT *dst_rect, DWORD flags) { - struct wined3d_surface *back_buffer = swapchain->back_buffers[0]->sub_resources[0].u.surface; + struct wined3d_texture *back_buffer = swapchain->back_buffers[0]; const struct wined3d_fb_state *fb = &swapchain->device->fb; const struct wined3d_gl_info *gl_info; struct wined3d_texture *logo_texture; struct wined3d_context *context; BOOL render_to_fbo; - context = context_acquire(swapchain->device, back_buffer); + context = context_acquire(swapchain->device, back_buffer->sub_resources[0].u.surface); if (!context->valid) { context_release(context); @@ -505,7 +505,7 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, RECT rect = {0, 0, logo_texture->resource.width, logo_texture->resource.height}; /* Blit the logo into the upper left corner of the drawable. */ - wined3d_texture_blt(swapchain->back_buffers[0], 0, &rect, logo_texture, 0, &rect, + wined3d_texture_blt(back_buffer, 0, &rect, logo_texture, 0, &rect, WINED3D_BLT_ALPHA_TEST, NULL, WINED3D_TEXF_POINT); } @@ -525,16 +525,14 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, swapchain->device->cursor_texture->resource.width, swapchain->device->cursor_texture->resource.height }; - const RECT clip_rect = {0, 0, - swapchain->back_buffers[0]->resource.width, - swapchain->back_buffers[0]->resource.height}; + const RECT clip_rect = {0, 0, back_buffer->resource.width, back_buffer->resource.height}; TRACE("Rendering the software cursor.\n"); if (swapchain->desc.windowed) MapWindowPoints(NULL, swapchain->win_handle, (POINT *)&dst_rect, 2); if (wined3d_clip_blit(&clip_rect, &dst_rect, &src_rect)) - wined3d_texture_blt(swapchain->back_buffers[0], 0, &dst_rect, + wined3d_texture_blt(back_buffer, 0, &dst_rect, swapchain->device->cursor_texture, 0, &src_rect, WINED3D_BLT_ALPHA_TEST, NULL, WINED3D_TEXF_POINT); } @@ -559,14 +557,14 @@ static void swapchain_gl_present(struct wined3d_swapchain *swapchain, */ if (!swapchain->render_to_fbo && render_to_fbo && wined3d_settings.offscreen_rendering_mode == ORM_FBO) { - surface_load_location(back_buffer, context, WINED3D_LOCATION_TEXTURE_RGB); - wined3d_texture_invalidate_location(back_buffer->container, 0, WINED3D_LOCATION_DRAWABLE); + wined3d_texture_load_location(back_buffer, 0, context, WINED3D_LOCATION_TEXTURE_RGB); + wined3d_texture_invalidate_location(back_buffer, 0, WINED3D_LOCATION_DRAWABLE); swapchain->render_to_fbo = TRUE; swapchain_update_draw_bindings(swapchain); } else { - surface_load_location(back_buffer, context, back_buffer->container->resource.draw_binding); + wined3d_texture_load_location(back_buffer, 0, context, back_buffer->resource.draw_binding); } if (swapchain->render_to_fbo)
1
0
0
0
Henri Verbeet : wined3d: Use wined3d_texture_load_location() in wined3d_swapchain_rotate().
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: 42b90efdfd8d2f019d9e85f9829d6bc2097359cc URL:
http://source.winehq.org/git/wine.git/?a=commit;h=42b90efdfd8d2f019d9e85f98…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Aug 4 12:06:57 2016 +0200 wined3d: Use wined3d_texture_load_location() in wined3d_swapchain_rotate(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/swapchain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index 0543d77..13106bf 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -460,7 +460,7 @@ static void wined3d_swapchain_rotate(struct wined3d_swapchain *swapchain, struct sub_resource = &texture->sub_resources[0]; if (!(sub_resource->locations & supported_locations)) - surface_load_location(sub_resource->u.surface, context, texture->resource.draw_binding); + wined3d_texture_load_location(texture, 0, context, texture->resource.draw_binding); texture_prev->texture_rgb = texture->texture_rgb; texture_prev->rb_multisample = texture->rb_multisample;
1
0
0
0
Henri Verbeet : wined3d: Use wined3d_texture_load_location() in swapchain_blit().
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: 3e6494321e4c9b6a0f4000077f23da7299025ba3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=3e6494321e4c9b6a0f4000077…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Aug 4 12:06:56 2016 +0200 wined3d: Use wined3d_texture_load_location() in swapchain_blit(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/swapchain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index e3d6259..0543d77 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -330,7 +330,7 @@ static void swapchain_blit(const struct wined3d_swapchain *swapchain, if (texture->resource.multisample_type) { location = WINED3D_LOCATION_RB_RESOLVED; - surface_load_location(back_buffer, context, location); + wined3d_texture_load_location(texture, 0, context, location); } context_apply_fbo_state_blit(context, GL_READ_FRAMEBUFFER, back_buffer, NULL, location);
1
0
0
0
Henri Verbeet : wined3d: Use wined3d_texture_load_location() in wined3d_surface_blt().
by Alexandre Julliard
04 Aug '16
04 Aug '16
Module: wine Branch: master Commit: 140220375936ea4f2c5393d46027ed2d7de1d7a8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=140220375936ea4f2c5393d46…
Author: Henri Verbeet <hverbeet(a)codeweavers.com> Date: Thu Aug 4 12:06:55 2016 +0200 wined3d: Use wined3d_texture_load_location() in wined3d_surface_blt(). Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/wined3d/surface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 8ba63fd..efdea87 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -4226,7 +4226,8 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst if (!wined3d_resource_is_offscreen(&dst_texture->resource)) { struct wined3d_context *context = context_acquire(device, dst_surface); - surface_load_location(dst_surface, context, dst_texture->resource.draw_binding); + wined3d_texture_load_location(dst_texture, dst_sub_resource_idx, + context, dst_texture->resource.draw_binding); context_release(context); } return WINED3D_OK;
1
0
0
0
← Newer
1
...
63
64
65
66
67
68
69
...
78
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Results per page:
10
25
50
100
200