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

Alexandre Julliard julliard at winehq.org
Thu Dec 1 14:05:33 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Dec  1 13:23:03 2011 +0100

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

---

 dlls/jscript/compile.c |    2 ++
 dlls/jscript/engine.c  |   22 ++++++++++------------
 dlls/jscript/engine.h  |    2 +-
 dlls/jscript/parser.y  |    2 +-
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index e5598f6..04c247e 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -410,6 +410,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr)
         return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_in);
     case EXPR_LESS:
         return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_lt);
+    case EXPR_LESSEQ:
+        return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_lteq);
     case EXPR_LITERAL:
         return compile_literal(ctx, ((literal_expression_t*)expr)->literal);
     case EXPR_LOGNEG:
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 25af171..76cc0c8 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -3036,27 +3036,25 @@ static HRESULT interp_lt(exec_ctx_t *ctx)
     return stack_push_bool(ctx, b);
 }
 
-/* ECMA-262 3rd Edition    11.8.3 */
-HRESULT lesseq_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
+/* ECMA-262 3rd Edition    11.8.1 */
+static HRESULT interp_lteq(exec_ctx_t *ctx)
 {
-    binary_expression_t *expr = (binary_expression_t*)_expr;
-    VARIANT rval, lval;
+    VARIANT *l, *r;
     BOOL b;
     HRESULT hres;
 
-    TRACE("\n");
+    r = stack_pop(ctx);
+    l = stack_pop(ctx);
 
-    hres = get_binary_expr_values(ctx, expr, ei, &lval, &rval);
-    if(FAILED(hres))
-        return hres;
+    TRACE("%s <= %s\n", debugstr_variant(l), debugstr_variant(r));
 
-    hres = less_eval(ctx, &rval, &lval, TRUE, ei, &b);
-    VariantClear(&lval);
-    VariantClear(&rval);
+    hres = less_eval(ctx->parser->script, r, l, TRUE, &ctx->ei, &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.2 */
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index 7d39102..8131b5f 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -57,6 +57,7 @@ typedef struct _func_stack {
     X(jmp_nz,     0, ARG_ADDR,   0)        \
     X(jmp_z,      0, ARG_ADDR,   0)        \
     X(lt,         1, 0,0)                  \
+    X(lteq,       1, 0,0)                  \
     X(minus,      1, 0,0)                  \
     X(mod,        1, 0,0)                  \
     X(mul,        1, 0,0)                  \
@@ -561,7 +562,6 @@ HRESULT post_increment_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcep
 HRESULT post_decrement_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
 HRESULT pre_increment_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
 HRESULT pre_decrement_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;
 HRESULT greatereq_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;
diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y
index 45d1ce9..e815667 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -1332,7 +1332,7 @@ static const expression_eval_t expression_eval_table[] = {
    compiled_expression_eval,
    compiled_expression_eval,
    compiled_expression_eval,
-   lesseq_expression_eval,
+   compiled_expression_eval,
    greater_expression_eval,
    greatereq_expression_eval,
    compiled_expression_eval,




More information about the wine-cvs mailing list