Jacek Caban : jscript: Use bytecode for '-=' expression implementation.

Alexandre Julliard julliard at winehq.org
Mon Dec 5 14:55:01 CST 2011


Module: wine
Branch: master
Commit: 7b022dbbb8e8323122ffbbfdcb2674421511b9fc
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7b022dbbb8e8323122ffbbfdcb2674421511b9fc

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Dec  5 11:13:14 2011 +0100

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 7c00cf9..2c6327e 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -479,6 +479,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr)
         return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_LAST);
     case EXPR_ASSIGNADD:
         return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_add);
+    case EXPR_ASSIGNSUB:
+        return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_sub);
     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 05dee4d..7627a5b 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -2402,24 +2402,6 @@ static HRESULT interp_add(exec_ctx_t *ctx)
 }
 
 /* ECMA-262 3rd Edition    11.6.2 */
-static HRESULT sub_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, num_val(&lnum) - num_val(&rnum));
-    return S_OK;
-}
-
-/* ECMA-262 3rd Edition    11.6.2 */
 static HRESULT interp_sub(exec_ctx_t *ctx)
 {
     VARIANT l, r;
@@ -3402,16 +3384,6 @@ HRESULT assign_rrshift_expression_eval(script_ctx_t *ctx, expression_t *_expr, D
 }
 
 /* ECMA-262 3rd Edition    11.13.2 */
-HRESULT assign_sub_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, sub_eval, ei, ret);
-}
-
-/* ECMA-262 3rd Edition    11.13.2 */
 HRESULT assign_mul_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;
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index f78c0bd..0f76eba 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_sub_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
 HRESULT assign_mul_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
 HRESULT assign_div_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;
diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y
index 783aad9..17c3b60 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -1345,7 +1345,7 @@ static const expression_eval_t expression_eval_table[] = {
    assign_rshift_expression_eval,
    assign_rrshift_expression_eval,
    compiled_expression_eval,
-   assign_sub_expression_eval,
+   compiled_expression_eval,
    assign_mul_expression_eval,
    assign_div_expression_eval,
    assign_mod_expression_eval,




More information about the wine-cvs mailing list