jscript: Always use bytecode for switch statement.

This commit is contained in:
Jacek Caban 2011-12-29 11:07:08 +01:00 committed by Alexandre Julliard
parent f904bc8e78
commit 985c6a1943
3 changed files with 0 additions and 77 deletions

View File

@ -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;

View File

@ -915,74 +915,6 @@ static HRESULT interp_case(exec_ctx_t *ctx)
return S_OK;
}
/* 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)
{

View File

@ -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 {