From 822fdde42dc5bbcadf0b114a87ad4dcd3b98f9de Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 6 Dec 2011 10:41:57 +0100 Subject: [PATCH] jscript: Use bytecode for '%=' expression implementation. --- dlls/jscript/compile.c | 2 ++ dlls/jscript/engine.c | 28 ---------------------------- dlls/jscript/engine.h | 1 - dlls/jscript/parser.y | 2 +- 4 files changed, 3 insertions(+), 30 deletions(-) diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c index bcbbaf31ce3..af227c0f835 100644 --- a/dlls/jscript/compile.c +++ b/dlls/jscript/compile.c @@ -485,6 +485,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr) return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_mul); case EXPR_ASSIGNDIV: return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_div); + case EXPR_ASSIGNMOD: + return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_mod); case EXPR_BITNEG: return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_bneg); case EXPR_BOR: diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index ef43451a919..0696e778c10 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -2458,24 +2458,6 @@ static HRESULT interp_div(exec_ctx_t *ctx) return stack_push_number(ctx, num_val(&l)/num_val(&r)); } -/* ECMA-262 3rd Edition 11.5.3 */ -static HRESULT mod_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_t *ei, VARIANT *retv) -{ - VARIANT lnum, rnum; - HRESULT hres; - - hres = to_number(ctx, lval, ei, &lnum); - if(FAILED(hres)) - return hres; - - hres = to_number(ctx, rval, ei, &rnum); - if(FAILED(hres)) - return hres; - - num_set_val(retv, fmod(num_val(&lnum), num_val(&rnum))); - return S_OK; -} - /* ECMA-262 3rd Edition 11.5.3 */ static HRESULT interp_mod(exec_ctx_t *ctx) { @@ -3347,16 +3329,6 @@ HRESULT assign_rrshift_expression_eval(script_ctx_t *ctx, expression_t *_expr, D return assign_oper_eval(ctx, expr->expression1, expr->expression2, rshift2_eval, ei, ret); } -/* ECMA-262 3rd Edition 11.13.2 */ -HRESULT assign_mod_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) -{ - binary_expression_t *expr = (binary_expression_t*)_expr; - - TRACE("\n"); - - return assign_oper_eval(ctx, expr->expression1, expr->expression2, mod_eval, ei, ret); -} - /* ECMA-262 3rd Edition 11.13.2 */ HRESULT assign_and_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) { diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 18f44012746..54e28a9f093 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -575,7 +575,6 @@ HRESULT right2_shift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_ HRESULT assign_lshift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT assign_rshift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT assign_rrshift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; -HRESULT assign_mod_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT assign_and_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT assign_or_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT assign_xor_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 36c5ecf9620..8051c8ada65 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -1348,7 +1348,7 @@ static const expression_eval_t expression_eval_table[] = { compiled_expression_eval, compiled_expression_eval, compiled_expression_eval, - assign_mod_expression_eval, + compiled_expression_eval, assign_and_expression_eval, assign_or_expression_eval, assign_xor_expression_eval,