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

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


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

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

jscript: Always use bytecode for for statement.

---

 dlls/jscript/compile.c |    9 +----
 dlls/jscript/engine.c  |   94 ------------------------------------------------
 dlls/jscript/engine.h  |    1 -
 3 files changed, 1 insertions(+), 103 deletions(-)

diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index da9b107..e4c5332 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -1084,11 +1084,9 @@ static HRESULT compile_while_statement(compiler_ctx_t *ctx, while_statement_t *s
 static HRESULT compile_for_statement(compiler_ctx_t *ctx, for_statement_t *stat)
 {
     statement_ctx_t stat_ctx = {0, FALSE, FALSE};
-    unsigned off_backup, expr_off;
+    unsigned expr_off;
     HRESULT hres;
 
-    off_backup = ctx->code_off;
-
     if(stat->variable_list) {
         hres = compile_variable_list(ctx, stat->variable_list);
         if(FAILED(hres))
@@ -1131,11 +1129,6 @@ static HRESULT compile_for_statement(compiler_ctx_t *ctx, for_statement_t *stat)
         return E_OUTOFMEMORY;
 
     hres = compile_statement(ctx, &stat_ctx, stat->statement);
-    if(hres == E_NOTIMPL) {
-        ctx->code_off = off_backup;
-        stat->stat.eval = for_statement_eval;
-        return compile_interp_fallback(ctx, &stat->stat);
-    }
     if(FAILED(hres))
         return hres;
 
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 896fc9a..6e8ae3c 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -657,31 +657,6 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, DWORD flags,
 }
 
 /* ECMA-262 3rd Edition    12.2 */
-static HRESULT variable_list_eval(script_ctx_t *ctx, variable_declaration_t *var_list, jsexcept_t *ei)
-{
-    variable_declaration_t *iter;
-    HRESULT hres = S_OK;
-
-    for(iter = var_list; iter; iter = iter->next) {
-        VARIANT val;
-
-        if(!iter->expr)
-            continue;
-
-        hres = expr_eval(ctx, iter->expr, ei, &val);
-        if(FAILED(hres))
-            break;
-
-        hres = jsdisp_propput_name(ctx->exec_ctx->var_disp, iter->identifier, &val, ei, NULL/*FIXME*/);
-        VariantClear(&val);
-        if(FAILED(hres))
-            break;
-    }
-
-    return hres;
-}
-
-/* ECMA-262 3rd Edition    12.2 */
 static HRESULT interp_var_set(exec_ctx_t *ctx)
 {
     const BSTR name = ctx->parser->code->instrs[ctx->ip].arg1.bstr;
@@ -749,75 +724,6 @@ HRESULT while_statement_eval(script_ctx_t *ctx, statement_t *_stat, return_type_
     return S_OK;
 }
 
-/* ECMA-262 3rd Edition    12.6.3 */
-HRESULT for_statement_eval(script_ctx_t *ctx, statement_t *_stat, return_type_t *rt, VARIANT *ret)
-{
-    for_statement_t *stat = (for_statement_t*)_stat;
-    VARIANT val, tmp, retv;
-    VARIANT_BOOL b;
-    HRESULT hres;
-
-    TRACE("\n");
-
-    if(stat->variable_list) {
-        hres = variable_list_eval(ctx, stat->variable_list, &rt->ei);
-        if(FAILED(hres))
-            return hres;
-    }else if(stat->begin_expr) {
-        hres = expr_eval(ctx, stat->begin_expr, &rt->ei, &val);
-        if(FAILED(hres))
-            return hres;
-
-        VariantClear(&val);
-    }
-
-    V_VT(&retv) = VT_EMPTY;
-
-    while(1) {
-        if(stat->expr) {
-            hres = expr_eval(ctx, stat->expr, &rt->ei, &tmp);
-            if(FAILED(hres))
-                break;
-
-            hres = to_boolean(&tmp, &b);
-            VariantClear(&tmp);
-            if(FAILED(hres) || !b)
-                break;
-        }
-
-        hres = stat_eval(ctx, stat->statement, rt, &tmp);
-        if(FAILED(hres))
-            break;
-
-        VariantClear(&retv);
-        retv = tmp;
-
-        if(rt->type == RT_CONTINUE)
-            rt->type = RT_NORMAL;
-        else if(rt->type != RT_NORMAL)
-            break;
-
-        if(stat->end_expr) {
-            hres = expr_eval(ctx, stat->end_expr, &rt->ei, &val);
-            if(FAILED(hres))
-                break;
-
-            VariantClear(&val);
-        }
-    }
-
-    if(FAILED(hres)) {
-        VariantClear(&retv);
-        return hres;
-    }
-
-    if(rt->type == RT_BREAK)
-        rt->type = RT_NORMAL;
-
-    *ret = retv;
-    return S_OK;
-}
-
 /* ECMA-262 3rd Edition    12.6.4 */
 static HRESULT interp_forin(exec_ctx_t *ctx)
 {
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index f137d8b..f4f06c1 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -414,7 +414,6 @@ typedef struct {
 
 HRESULT compiled_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
 HRESULT while_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
-HRESULT for_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
 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;




More information about the wine-cvs mailing list