Jacek Caban : jscript: Use bytecode for '>>>' expression implementation.
Alexandre Julliard
julliard at winehq.org
Fri Dec 9 14:41:37 CST 2011
Module: wine
Branch: master
Commit: 96e822a33edd16ed0486443a0f3f48d6eb5d8df6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=96e822a33edd16ed0486443a0f3f48d6eb5d8df6
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Dec 9 11:04:24 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, 15 insertions(+), 6 deletions(-)
diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index d733c33..ececd10 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -693,6 +693,8 @@ static HRESULT compile_expression_noret(compiler_ctx_t *ctx, expression_t *expr,
return compile_increment_expression(ctx, (unary_expression_t*)expr, OP_preinc, 1);
case EXPR_RSHIFT:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_rshift);
+ case EXPR_RRSHIFT:
+ return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_rshift2);
case EXPR_SUB:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_sub);
case EXPR_THIS:
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 6a76f8e..1699d84 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -3160,13 +3160,20 @@ static HRESULT rshift2_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jse
}
/* ECMA-262 3rd Edition 11.7.3 */
-HRESULT right2_shift_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+static HRESULT interp_rshift2(exec_ctx_t *ctx)
{
- binary_expression_t *expr = (binary_expression_t*)_expr;
+ DWORD r, l;
+ HRESULT hres;
- TRACE("\n");
+ hres = stack_pop_uint(ctx, &r);
+ if(FAILED(hres))
+ return hres;
- return binary_expr_eval(ctx, expr, rshift2_eval, ei, ret);
+ hres = stack_pop_uint(ctx, &l);
+ if(FAILED(hres))
+ return hres;
+
+ return stack_push_int(ctx, l >> (r&0x1f));
}
/* ECMA-262 3rd Edition 11.13.1 */
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index dc7f6ac..5b0a869 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -83,6 +83,7 @@ typedef struct _func_stack {
X(preinc, 1, ARG_INT, 0) \
X(regexp, 1, ARG_STR, ARG_INT) \
X(rshift, 1, 0,0) \
+ X(rshift2, 1, 0,0) \
X(str, 1, ARG_STR, 0) \
X(this, 1, 0,0) \
X(throw, 0, ARG_UINT, 0) \
@@ -567,7 +568,6 @@ HRESULT instanceof_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*
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;
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_rrshift_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 3322206..f07280b 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -1338,7 +1338,7 @@ static const expression_eval_t expression_eval_table[] = {
compiled_expression_eval,
left_shift_expression_eval,
compiled_expression_eval,
- right2_shift_expression_eval,
+ compiled_expression_eval,
compiled_expression_eval,
assign_lshift_expression_eval,
compiled_expression_eval,
More information about the wine-cvs
mailing list