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: 7c3728d728da6a0732eb265e0a195f75e71b4490
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=7c3728d728da6a0732eb265e0a195f75e71b4490

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Dec  9 11:05:08 2011 +0100

jscript: Use bytecode for '<<=' expression implementation.

---

 dlls/jscript/compile.c |    2 +
 dlls/jscript/engine.c  |   71 ------------------------------------------------
 dlls/jscript/engine.h  |    1 -
 dlls/jscript/parser.y  |    2 +-
 4 files changed, 3 insertions(+), 73 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 0f85471..1121838 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_ASSIGNLSHIFT:
+        return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_lshift);
     case EXPR_ASSIGNRSHIFT:
         return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_rshift);
     case EXPR_ASSIGNRRSHIFT:
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 0f74940..7886c0c 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -1440,47 +1440,6 @@ static HRESULT binary_expr_eval(script_ctx_t *ctx, binary_expression_t *expr, op
     return S_OK;
 }
 
-/* ECMA-262 3rd Edition    11.13.2 */
-static HRESULT assign_oper_eval(script_ctx_t *ctx, expression_t *lexpr, expression_t *rexpr, oper_t oper,
-                                jsexcept_t *ei, exprval_t *ret)
-{
-    VARIANT retv, lval, rval;
-    exprval_t exprval, exprvalr;
-    HRESULT hres;
-
-    hres = expr_eval(ctx, lexpr, EXPR_NEWREF, ei, &exprval);
-    if(FAILED(hres))
-        return hres;
-
-    hres = exprval_value(ctx, &exprval, ei, &lval);
-    if(SUCCEEDED(hres)) {
-        hres = expr_eval(ctx, rexpr, 0, ei, &exprvalr);
-        if(SUCCEEDED(hres)) {
-            hres = exprval_value(ctx, &exprvalr, ei, &rval);
-            exprval_release(&exprvalr);
-        }
-        if(SUCCEEDED(hres)) {
-            hres = oper(ctx, &lval, &rval, ei, &retv);
-            VariantClear(&rval);
-        }
-        VariantClear(&lval);
-    }
-
-    if(SUCCEEDED(hres)) {
-        hres = put_value(ctx, &exprval, &retv, ei);
-        if(FAILED(hres))
-            VariantClear(&retv);
-    }
-    exprval_release(&exprval);
-
-    if(FAILED(hres))
-        return hres;
-
-    ret->type = EXPRVAL_VARIANT;
-    ret->u.var = retv;
-    return S_OK;
-}
-
 /* ECMA-262 3rd Edition    13 */
 HRESULT function_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
 {
@@ -3093,26 +3052,6 @@ static HRESULT interp_neg(exec_ctx_t *ctx)
 }
 
 /* ECMA-262 3rd Edition    11.7.1 */
-static HRESULT lshift_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.1 */
 static HRESULT interp_lshift(exec_ctx_t *ctx)
 {
     DWORD r;
@@ -3191,16 +3130,6 @@ static HRESULT interp_assign(exec_ctx_t *ctx)
     return stack_push(ctx, v);
 }
 
-/* ECMA-262 3rd Edition    11.13.2 */
-HRESULT assign_lshift_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, lshift_eval, ei, ret);
-}
-
 static HRESULT interp_undefined(exec_ctx_t *ctx)
 {
     VARIANT v;
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index d7714fe..e6ad0c9 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -568,7 +568,6 @@ HRESULT property_value_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcep
 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;
-HRESULT assign_lshift_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 3019c60..76d1c1d 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -1340,7 +1340,7 @@ static const expression_eval_t expression_eval_table[] = {
    compiled_expression_eval,
    compiled_expression_eval,
    compiled_expression_eval,
-   assign_lshift_expression_eval,
+   compiled_expression_eval,
    compiled_expression_eval,
    compiled_expression_eval,
    compiled_expression_eval,




More information about the wine-cvs mailing list