Jacek Caban : jscript: Use bytecode for binary xor expressions.
Alexandre Julliard
julliard at winehq.org
Tue Nov 29 14:20:38 CST 2011
Module: wine
Branch: master
Commit: 0505e03b570fbdc27f97f605375adfa4338581b8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0505e03b570fbdc27f97f605375adfa4338581b8
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Nov 29 11:09:49 2011 +0100
jscript: Use bytecode for binary xor expressions.
---
dlls/jscript/compile.c | 2 ++
dlls/jscript/engine.c | 15 ++++++++++++---
dlls/jscript/engine.h | 4 ++--
dlls/jscript/parser.y | 2 +-
4 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 7520756..b7abdda 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -388,6 +388,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr)
return push_instr(ctx, OP_this) == -1 ? E_OUTOFMEMORY : S_OK;
case EXPR_VOID:
return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_void);
+ case EXPR_BXOR:
+ return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_xor);
default:
assert(expr->eval != compiled_expression_eval);
return compile_interp_fallback(ctx, expr);
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 16a3a06..2d766e4 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -2061,13 +2061,22 @@ static HRESULT xor_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcep
}
/* ECMA-262 3rd Edition 11.10 */
-HRESULT binary_xor_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+static HRESULT interp_xor(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, xor_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.10 */
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index 6ac6d23..58f12c7 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -72,7 +72,8 @@ typedef struct _func_stack {
X(tree, 1, ARG_EXPR, 0) \
X(ret, 0, 0,0) \
X(sub, 1, 0,0) \
- X(void, 1, 0,0)
+ X(void, 1, 0,0) \
+ X(xor, 1, 0,0)
typedef enum {
#define X(x,a,b,c) OP_##x,
@@ -555,7 +556,6 @@ HRESULT identifier_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*
HRESULT array_literal_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_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 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 fecde80..0912107 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_xor_expression_eval,
+ compiled_expression_eval,
binary_and_expression_eval,
instanceof_expression_eval,
compiled_expression_eval,
More information about the wine-cvs
mailing list