Jacek Caban : jscript: Use bytecode for bool literal implementation.

Alexandre Julliard julliard at winehq.org
Wed Nov 23 13:40:06 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed Nov 23 12:13:57 2011 +0100

jscript: Use bytecode for bool literal implementation.

---

 dlls/jscript/compile.c |    2 ++
 dlls/jscript/engine.c  |   10 ++++++++++
 dlls/jscript/engine.h  |    1 +
 3 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 780e6b5..2f2516b 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -121,6 +121,8 @@ static HRESULT compile_literal(compiler_ctx_t *ctx, literal_expression_t *expr)
     literal_t *literal = expr->literal;
 
     switch(literal->type) {
+    case LT_BOOL:
+        return push_instr_int(ctx, OP_bool, literal->u.bval);
     case LT_INT:
         return push_instr_int(ctx, OP_int, literal->u.lval);
     default:
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 792ba13..1d35496 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -1724,6 +1724,16 @@ HRESULT identifier_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD
     return hres;
 }
 
+/* ECMA-262 3rd Edition    7.8.2 */
+HRESULT interp_bool(exec_ctx_t *ctx)
+{
+    const LONG arg = ctx->parser->code->instrs[ctx->ip].arg1.lng;
+
+    TRACE("%s\n", arg ? "true" : "false");
+
+    return stack_push_bool(ctx, arg);
+}
+
 /* ECMA-262 3rd Edition    7.8.3 */
 HRESULT interp_int(exec_ctx_t *ctx)
 {
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index c210bb7..302f9a5 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -43,6 +43,7 @@ typedef struct _func_stack {
 
 #define OP_LIST                                   \
     X(add, 1, 0)                                  \
+    X(bool, 1, 0)                                 \
     X(bneg, 1, 0)                                 \
     X(eq2, 1, 0)                                  \
     X(in, 1, 0)                                   \




More information about the wine-cvs mailing list