Module: wine Branch: master Commit: cf68237c8010f2b7fa8279753383cdf8e83067a4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=cf68237c8010f2b7fa82797533...
Author: Jacek Caban jacek@codeweavers.com Date: Tue Nov 29 11:08:54 2011 +0100
jscript: Use bytecode for '*' expression implementation.
---
dlls/jscript/compile.c | 2 ++ dlls/jscript/engine.c | 15 ++++++++++++--- dlls/jscript/engine.h | 2 +- dlls/jscript/parser.y | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c index 3ee3d40..a529fe7 100644 --- a/dlls/jscript/compile.c +++ b/dlls/jscript/compile.c @@ -364,6 +364,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr) return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_neg); case EXPR_MINUS: return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_minus); + case EXPR_MUL: + return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_mul); case EXPR_NEW: return compile_new_expression(ctx, (call_expression_t*)expr); case EXPR_NOTEQ: diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index 273281e..5e60381 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -2323,13 +2323,22 @@ static HRESULT mul_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcep }
/* ECMA-262 3rd Edition 11.5.1 */ -HRESULT mul_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) +HRESULT interp_mul(exec_ctx_t *ctx) { - binary_expression_t *expr = (binary_expression_t*)_expr; + VARIANT l, r; + HRESULT hres;
TRACE("\n");
- return binary_expr_eval(ctx, expr, mul_eval, ei, ret); + hres = stack_pop_number(ctx, &r); + if(FAILED(hres)) + return hres; + + hres = stack_pop_number(ctx, &l); + if(FAILED(hres)) + return hres; + + return stack_push_number(ctx, num_val(&l)*num_val(&r)); }
/* ECMA-262 3rd Edition 11.5.2 */ diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 807bb8a..120bf42 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -55,6 +55,7 @@ typedef struct _func_stack { X(jmp_nz, 0, ARG_ADDR, 0) \ X(jmp_z, 0, ARG_ADDR, 0) \ X(minus, 1, 0,0) \ + X(mul, 1, 0,0) \ X(neg, 1, 0,0) \ X(neq, 1, 0,0) \ X(neq2, 1, 0,0) \ @@ -555,7 +556,6 @@ HRESULT binary_or_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*, HRESULT binary_xor_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT binary_and_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT instanceof_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; -HRESULT mul_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT div_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT mod_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT delete_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index 617c848..9b72d7f 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -1315,7 +1315,7 @@ static const expression_eval_t expression_eval_table[] = { compiled_expression_eval, compiled_expression_eval, compiled_expression_eval, - mul_expression_eval, + compiled_expression_eval, div_expression_eval, mod_expression_eval, delete_expression_eval,