From d30bfb6e54d8d0f62606328d1e83885efa6c1e12 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 8 Dec 2011 12:03:35 +0100 Subject: [PATCH] jscript: Use bytecode for '>>=' expression. --- dlls/jscript/compile.c | 2 ++ dlls/jscript/engine.c | 40 ---------------------------------------- dlls/jscript/engine.h | 1 - dlls/jscript/parser.y | 2 +- 4 files changed, 3 insertions(+), 42 deletions(-) diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c index 2fa72759b7..d733c33154 100644 --- a/dlls/jscript/compile.c +++ b/dlls/jscript/compile.c @@ -625,6 +625,8 @@ static HRESULT compile_expression_noret(compiler_ctx_t *ctx, expression_t *expr, return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_mod); case EXPR_ASSIGNOR: return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_or); + case EXPR_ASSIGNRSHIFT: + return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_rshift); case EXPR_ASSIGNXOR: return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_xor); case EXPR_BAND: diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index f6b9762fd1..63ae9d7206 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -3119,26 +3119,6 @@ HRESULT left_shift_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD return binary_expr_eval(ctx, expr, lshift_eval, ei, ret); } -/* ECMA-262 3rd Edition 11.7.2 */ -static HRESULT rshift_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_t *ei, VARIANT *retv) -{ - DWORD ri; - INT li; - HRESULT hres; - - hres = to_int32(ctx, lval, ei, &li); - if(FAILED(hres)) - return hres; - - hres = to_uint32(ctx, rval, ei, &ri); - if(FAILED(hres)) - return hres; - - V_VT(retv) = VT_I4; - V_I4(retv) = li >> (ri&0x1f); - return S_OK; -} - /* ECMA-262 3rd Edition 11.7.2 */ static HRESULT interp_rshift(exec_ctx_t *ctx) { @@ -3157,16 +3137,6 @@ static HRESULT interp_rshift(exec_ctx_t *ctx) return stack_push_int(ctx, l >> (r&0x1f)); } -/* ECMA-262 3rd Edition 11.7.2 */ -HRESULT right_shift_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 binary_expr_eval(ctx, expr, rshift_eval, ei, ret); -} - /* ECMA-262 3rd Edition 11.7.3 */ static HRESULT rshift2_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_t *ei, VARIANT *retv) { @@ -3232,16 +3202,6 @@ HRESULT assign_lshift_expression_eval(script_ctx_t *ctx, expression_t *_expr, DW return assign_oper_eval(ctx, expr->expression1, expr->expression2, lshift_eval, ei, ret); } -/* ECMA-262 3rd Edition 11.13.2 */ -HRESULT assign_rshift_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, rshift_eval, ei, ret); -} - /* ECMA-262 3rd Edition 11.13.2 */ HRESULT assign_rrshift_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 504462c4d8..dc7f6ac791 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -569,7 +569,6 @@ HRESULT typeof_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exp HRESULT left_shift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT right2_shift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; 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 compiled_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 5d42ef0540..3322206331 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -1341,7 +1341,7 @@ static const expression_eval_t expression_eval_table[] = { right2_shift_expression_eval, compiled_expression_eval, assign_lshift_expression_eval, - assign_rshift_expression_eval, + compiled_expression_eval, assign_rrshift_expression_eval, compiled_expression_eval, compiled_expression_eval, -- 2.32.0.93.g670b81a890