Jacek Caban : jscript: Use bytecode interpreter for '!==' expressions.

Alexandre Julliard julliard at winehq.org
Fri Nov 18 10:19:07 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Nov 18 14:10:17 2011 +0100

jscript: Use bytecode interpreter for '!==' expressions.

---

 dlls/jscript/compile.c |    3 +++
 dlls/jscript/engine.c  |   18 ++++++++----------
 dlls/jscript/engine.h  |    2 +-
 dlls/jscript/parser.y  |    2 +-
 4 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index c2f8eff..b93ab52 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -98,7 +98,10 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr)
     switch(expr->type) {
     case EXPR_EQEQ:
         return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_eq2);
+    case EXPR_NOTEQEQ:
+        return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_neq2);
     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 102dadd..6353d12 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -2864,26 +2864,24 @@ HRESULT not_equal_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD
 }
 
 /* ECMA-262 3rd Edition    11.9.5 */
-HRESULT not_equal2_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+static HRESULT interp_neq2(exec_ctx_t *ctx)
 {
-    binary_expression_t *expr = (binary_expression_t*)_expr;
-    VARIANT rval, lval;
+    VARIANT *l, *r;
     BOOL b;
     HRESULT hres;
 
     TRACE("\n");
 
-    hres = get_binary_expr_values(ctx, expr, ei, &lval, &rval);
-    if(FAILED(hres))
-        return hres;
+    r = stack_pop(ctx);
+    l = stack_pop(ctx);
 
-    hres = equal2_values(&lval, &rval, &b);
-    VariantClear(&lval);
-    VariantClear(&rval);
+    hres = equal2_values(r, l, &b);
+    VariantClear(l);
+    VariantClear(r);
     if(FAILED(hres))
         return hres;
 
-    return return_bool(ret, !b);
+    return stack_push_bool(ctx, !b);
 }
 
 /* ECMA-262 3rd Edition    11.8.5 */
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index 09f6e11..5c46e39 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -43,6 +43,7 @@ typedef struct _func_stack {
 
 #define OP_LIST                                   \
     X(eq2, 1, 0)                                  \
+    X(neq2, 1, 0)                                 \
     X(tree, 1, ARG_EXPR)                          \
     X(ret, 0, 0)
 
@@ -541,7 +542,6 @@ HRESULT pre_increment_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept
 HRESULT pre_decrement_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
 HRESULT equal_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
 HRESULT not_equal_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
-HRESULT not_equal2_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
 HRESULT less_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
 HRESULT lesseq_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
 HRESULT greater_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 444871b..310ff2a 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -1330,7 +1330,7 @@ static const expression_eval_t expression_eval_table[] = {
    equal_expression_eval,
    compiled_expression_eval,
    not_equal_expression_eval,
-   not_equal2_expression_eval,
+   compiled_expression_eval,
    less_expression_eval,
    lesseq_expression_eval,
    greater_expression_eval,




More information about the wine-cvs mailing list