From 1ef486421ed94e54094545e391f864701ece9cc3 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 8 Dec 2011 12:02:53 +0100 Subject: [PATCH] jscript: Use bytecode for binary and 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 f0f9cc029a8..9e1ed6a7ed5 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_or); case EXPR_ASSIGNXOR: return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_xor); + case EXPR_BAND: + return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_and); 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 f72ee42234d..50aab416b66 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -2184,13 +2184,22 @@ static HRESULT bitand_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsex } /* ECMA-262 3rd Edition 11.10 */ -HRESULT binary_and_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) +static HRESULT interp_and(exec_ctx_t *ctx) { - binary_expression_t *expr = (binary_expression_t*)_expr; + INT l, r; + HRESULT hres; TRACE("\n"); - return binary_expr_eval(ctx, expr, bitand_eval, ei, ret); + hres = stack_pop_int(ctx, &r); + if(FAILED(hres)) + return hres; + + hres = stack_pop_int(ctx, &l); + if(FAILED(hres)) + return hres; + + return stack_push_int(ctx, l&r); } /* ECMA-262 3rd Edition 11.8.6 */ diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 4bee8248d13..582bc1f0018 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -43,6 +43,7 @@ typedef struct _func_stack { #define OP_LIST \ X(add, 1, 0,0) \ + X(and, 1, 0,0) \ X(array, 1, 0,0) \ X(assign, 1, 0,0) \ X(bool, 1, ARG_INT, 0) \ @@ -561,7 +562,6 @@ HRESULT member_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exp HRESULT identifier_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT property_value_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 delete_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT typeof_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 e7eadfa5faf..2d8361cf5cb 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -1309,7 +1309,7 @@ static const expression_eval_t expression_eval_table[] = { compiled_expression_eval, compiled_expression_eval, compiled_expression_eval, - binary_and_expression_eval, + compiled_expression_eval, instanceof_expression_eval, compiled_expression_eval, compiled_expression_eval,