Jacek Caban : jscript: Always use bytecode for switch statement.

Alexandre Julliard julliard at winehq.org
Thu Dec 29 12:15:45 CST 2011


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Thu Dec 29 11:07:08 2011 +0100

jscript: Always use bytecode for switch statement.

---

 dlls/jscript/compile.c |    8 -----
 dlls/jscript/engine.c  |   68 ------------------------------------------------
 dlls/jscript/engine.h  |    1 -
 3 files changed, 0 insertions(+), 77 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index e4c5332..076b768 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -1327,11 +1327,8 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
     BOOL have_default = FALSE;
     statement_t *stat_iter;
     case_clausule_t *iter;
-    unsigned off_backup;
     HRESULT hres;
 
-    off_backup = ctx->code_off;
-
     hres = compile_expression(ctx, stat->expr);
     if(FAILED(hres))
         return hres;
@@ -1394,11 +1391,6 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
 
         for(stat_iter = iter->stat; stat_iter && (!iter->next || iter->next->stat != stat_iter); stat_iter = stat_iter->next) {
             hres = compile_statement(ctx, &stat_ctx, stat_iter);
-            if(hres == E_NOTIMPL) {
-                ctx->code_off = off_backup;
-                stat->stat.eval = switch_statement_eval;
-                return compile_interp_fallback(ctx, &stat->stat);
-            }
             if(FAILED(hres))
                 break;
 
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 6e8ae3c..746002f 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -916,74 +916,6 @@ static HRESULT interp_case(exec_ctx_t *ctx)
 }
 
 /* ECMA-262 3rd Edition    12.13 */
-HRESULT switch_statement_eval(script_ctx_t *ctx, statement_t *_stat, return_type_t *rt, VARIANT *ret)
-{
-    switch_statement_t *stat = (switch_statement_t*)_stat;
-    case_clausule_t *iter, *default_clausule = NULL;
-    statement_t *stat_iter;
-    VARIANT val, cval;
-    BOOL b;
-    HRESULT hres;
-
-    TRACE("\n");
-
-    hres = expr_eval(ctx, stat->expr, &rt->ei, &val);
-    if(FAILED(hres))
-        return hres;
-
-    for(iter = stat->case_list; iter; iter = iter->next) {
-        if(!iter->expr) {
-            default_clausule = iter;
-            continue;
-        }
-
-        hres = expr_eval(ctx, iter->expr, &rt->ei, &cval);
-        if(FAILED(hres))
-            break;
-
-        hres = equal2_values(&val, &cval, &b);
-        VariantClear(&cval);
-        if(FAILED(hres) || b)
-            break;
-    }
-
-    VariantClear(&val);
-    if(FAILED(hres))
-        return hres;
-
-    if(!iter)
-        iter = default_clausule;
-
-    V_VT(&val) = VT_EMPTY;
-    if(iter) {
-        VARIANT tmp;
-
-        for(stat_iter = iter->stat; stat_iter; stat_iter = stat_iter->next) {
-            hres = stat_eval(ctx, stat_iter, rt, &tmp);
-            if(FAILED(hres))
-                break;
-
-            VariantClear(&val);
-            val = tmp;
-
-            if(rt->type != RT_NORMAL)
-                break;
-        }
-    }
-
-    if(FAILED(hres)) {
-        VariantClear(&val);
-        return hres;
-    }
-
-    if(rt->type == RT_BREAK)
-        rt->type = RT_NORMAL;
-
-    *ret = val;
-    return S_OK;
-}
-
-/* ECMA-262 3rd Edition    12.13 */
 static HRESULT interp_throw(exec_ctx_t *ctx)
 {
     TRACE("\n");
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index f4f06c1..385778e 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -417,7 +417,6 @@ HRESULT while_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*)
 HRESULT continue_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
 HRESULT break_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
 HRESULT return_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
-HRESULT switch_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
 HRESULT try_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
 
 typedef struct {




More information about the wine-cvs mailing list