Commit 8f8c8528 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Get rid of no longer needed no_fallback hack.

parent c5c2276a
...@@ -49,8 +49,6 @@ struct _compiler_ctx_t { ...@@ -49,8 +49,6 @@ struct _compiler_ctx_t {
unsigned labels_cnt; unsigned labels_cnt;
statement_ctx_t *stat_ctx; statement_ctx_t *stat_ctx;
BOOL no_fallback;
}; };
static const struct { static const struct {
...@@ -483,9 +481,6 @@ static HRESULT compile_interp_fallback(compiler_ctx_t *ctx, statement_t *stat) ...@@ -483,9 +481,6 @@ static HRESULT compile_interp_fallback(compiler_ctx_t *ctx, statement_t *stat)
{ {
unsigned instr; unsigned instr;
if(ctx->no_fallback)
return E_NOTIMPL;
instr = push_instr(ctx, OP_tree); instr = push_instr(ctx, OP_tree);
if(instr == -1) if(instr == -1)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1021,7 +1016,6 @@ static HRESULT compile_while_statement(compiler_ctx_t *ctx, while_statement_t *s ...@@ -1021,7 +1016,6 @@ static HRESULT compile_while_statement(compiler_ctx_t *ctx, while_statement_t *s
{ {
statement_ctx_t stat_ctx = {0, FALSE, FALSE}; statement_ctx_t stat_ctx = {0, FALSE, FALSE};
unsigned off_backup, jmp_off; unsigned off_backup, jmp_off;
BOOL prev_no_fallback;
HRESULT hres; HRESULT hres;
off_backup = ctx->code_off; off_backup = ctx->code_off;
...@@ -1055,10 +1049,7 @@ static HRESULT compile_while_statement(compiler_ctx_t *ctx, while_statement_t *s ...@@ -1055,10 +1049,7 @@ static HRESULT compile_while_statement(compiler_ctx_t *ctx, while_statement_t *s
jmp_off = ctx->code_off; jmp_off = ctx->code_off;
} }
prev_no_fallback = ctx->no_fallback;
ctx->no_fallback = TRUE;
hres = compile_statement(ctx, &stat_ctx, stat->statement); hres = compile_statement(ctx, &stat_ctx, stat->statement);
ctx->no_fallback = prev_no_fallback;
if(hres == E_NOTIMPL) { if(hres == E_NOTIMPL) {
ctx->code_off = off_backup; ctx->code_off = off_backup;
stat->stat.eval = while_statement_eval; stat->stat.eval = while_statement_eval;
...@@ -1094,7 +1085,6 @@ static HRESULT compile_for_statement(compiler_ctx_t *ctx, for_statement_t *stat) ...@@ -1094,7 +1085,6 @@ static HRESULT compile_for_statement(compiler_ctx_t *ctx, for_statement_t *stat)
{ {
statement_ctx_t stat_ctx = {0, FALSE, FALSE}; statement_ctx_t stat_ctx = {0, FALSE, FALSE};
unsigned off_backup, expr_off; unsigned off_backup, expr_off;
BOOL prev_no_fallback;
HRESULT hres; HRESULT hres;
off_backup = ctx->code_off; off_backup = ctx->code_off;
...@@ -1140,10 +1130,7 @@ static HRESULT compile_for_statement(compiler_ctx_t *ctx, for_statement_t *stat) ...@@ -1140,10 +1130,7 @@ static HRESULT compile_for_statement(compiler_ctx_t *ctx, for_statement_t *stat)
if(push_instr(ctx, OP_pop) == -1) if(push_instr(ctx, OP_pop) == -1)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
prev_no_fallback = ctx->no_fallback;
ctx->no_fallback = TRUE;
hres = compile_statement(ctx, &stat_ctx, stat->statement); hres = compile_statement(ctx, &stat_ctx, stat->statement);
ctx->no_fallback = prev_no_fallback;
if(hres == E_NOTIMPL) { if(hres == E_NOTIMPL) {
ctx->code_off = off_backup; ctx->code_off = off_backup;
stat->stat.eval = for_statement_eval; stat->stat.eval = for_statement_eval;
...@@ -1178,7 +1165,6 @@ static HRESULT compile_forin_statement(compiler_ctx_t *ctx, forin_statement_t *s ...@@ -1178,7 +1165,6 @@ static HRESULT compile_forin_statement(compiler_ctx_t *ctx, forin_statement_t *s
{ {
statement_ctx_t stat_ctx = {4, FALSE, FALSE}; statement_ctx_t stat_ctx = {4, FALSE, FALSE};
unsigned off_backup = ctx->code_off; unsigned off_backup = ctx->code_off;
BOOL prev_no_fallback;
HRESULT hres; HRESULT hres;
if(stat->variable) { if(stat->variable) {
...@@ -1229,10 +1215,7 @@ static HRESULT compile_forin_statement(compiler_ctx_t *ctx, forin_statement_t *s ...@@ -1229,10 +1215,7 @@ static HRESULT compile_forin_statement(compiler_ctx_t *ctx, forin_statement_t *s
if(FAILED(hres)) if(FAILED(hres))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
prev_no_fallback = ctx->no_fallback;
ctx->no_fallback = TRUE;
hres = compile_statement(ctx, &stat_ctx, stat->statement); hres = compile_statement(ctx, &stat_ctx, stat->statement);
ctx->no_fallback = prev_no_fallback;
if(hres == E_NOTIMPL) { if(hres == E_NOTIMPL) {
ctx->code_off = off_backup; ctx->code_off = off_backup;
stat->stat.eval = forin_statement_eval; stat->stat.eval = forin_statement_eval;
...@@ -1331,7 +1314,6 @@ static HRESULT compile_with_statement(compiler_ctx_t *ctx, with_statement_t *sta ...@@ -1331,7 +1314,6 @@ static HRESULT compile_with_statement(compiler_ctx_t *ctx, with_statement_t *sta
{ {
statement_ctx_t stat_ctx = {0, TRUE, FALSE, -1, -1}; statement_ctx_t stat_ctx = {0, TRUE, FALSE, -1, -1};
unsigned off_backup; unsigned off_backup;
BOOL prev_no_fallback;
HRESULT hres; HRESULT hres;
off_backup = ctx->code_off; off_backup = ctx->code_off;
...@@ -1343,10 +1325,7 @@ static HRESULT compile_with_statement(compiler_ctx_t *ctx, with_statement_t *sta ...@@ -1343,10 +1325,7 @@ static HRESULT compile_with_statement(compiler_ctx_t *ctx, with_statement_t *sta
if(push_instr(ctx, OP_push_scope) == -1) if(push_instr(ctx, OP_push_scope) == -1)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
prev_no_fallback = ctx->no_fallback;
ctx->no_fallback = TRUE;
hres = compile_statement(ctx, &stat_ctx, stat->statement); hres = compile_statement(ctx, &stat_ctx, stat->statement);
ctx->no_fallback = prev_no_fallback;
if(hres == E_NOTIMPL) { if(hres == E_NOTIMPL) {
ctx->code_off = off_backup; ctx->code_off = off_backup;
stat->stat.eval = with_statement_eval; stat->stat.eval = with_statement_eval;
...@@ -1370,7 +1349,6 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t ...@@ -1370,7 +1349,6 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
statement_t *stat_iter; statement_t *stat_iter;
case_clausule_t *iter; case_clausule_t *iter;
unsigned off_backup; unsigned off_backup;
BOOL prev_no_fallback;
HRESULT hres; HRESULT hres;
off_backup = ctx->code_off; off_backup = ctx->code_off;
...@@ -1436,10 +1414,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t ...@@ -1436,10 +1414,7 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
instr_ptr(ctx, iter->expr ? case_jmps[i++] : default_jmp)->arg1.uint = ctx->code_off; instr_ptr(ctx, iter->expr ? case_jmps[i++] : default_jmp)->arg1.uint = ctx->code_off;
for(stat_iter = iter->stat; stat_iter && (!iter->next || iter->next->stat != stat_iter); stat_iter = stat_iter->next) { for(stat_iter = iter->stat; stat_iter && (!iter->next || iter->next->stat != stat_iter); stat_iter = stat_iter->next) {
prev_no_fallback = ctx->no_fallback;
ctx->no_fallback = TRUE;
hres = compile_statement(ctx, &stat_ctx, stat_iter); hres = compile_statement(ctx, &stat_ctx, stat_iter);
ctx->no_fallback = prev_no_fallback;
if(hres == E_NOTIMPL) { if(hres == E_NOTIMPL) {
ctx->code_off = off_backup; ctx->code_off = off_backup;
stat->stat.eval = switch_statement_eval; stat->stat.eval = switch_statement_eval;
...@@ -1487,12 +1462,10 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat) ...@@ -1487,12 +1462,10 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat)
statement_ctx_t try_ctx = {0, FALSE, TRUE, -1, -1}, catch_ctx = {0, TRUE, FALSE, -1, -1}; statement_ctx_t try_ctx = {0, FALSE, TRUE, -1, -1}, catch_ctx = {0, TRUE, FALSE, -1, -1};
statement_ctx_t finally_ctx = {2, FALSE, FALSE, -1, -1}; statement_ctx_t finally_ctx = {2, FALSE, FALSE, -1, -1};
unsigned off_backup, push_except; unsigned off_backup, push_except;
BOOL prev_no_fallback;
BSTR ident; BSTR ident;
HRESULT hres; HRESULT hres;
off_backup = ctx->code_off; off_backup = ctx->code_off;
prev_no_fallback = ctx->no_fallback;
push_except = push_instr(ctx, OP_push_except); push_except = push_instr(ctx, OP_push_except);
if(push_except == -1) if(push_except == -1)
...@@ -1511,9 +1484,7 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat) ...@@ -1511,9 +1484,7 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat)
if(!stat->catch_block) if(!stat->catch_block)
try_ctx.stack_use = 2; try_ctx.stack_use = 2;
ctx->no_fallback = TRUE;
hres = compile_statement(ctx, &try_ctx, stat->try_statement); hres = compile_statement(ctx, &try_ctx, stat->try_statement);
ctx->no_fallback = prev_no_fallback;
if(hres == E_NOTIMPL) { if(hres == E_NOTIMPL) {
ctx->code_off = off_backup; ctx->code_off = off_backup;
stat->stat.eval = try_statement_eval; stat->stat.eval = try_statement_eval;
...@@ -1534,9 +1505,7 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat) ...@@ -1534,9 +1505,7 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat)
instr_ptr(ctx, push_except)->arg1.uint = ctx->code_off; instr_ptr(ctx, push_except)->arg1.uint = ctx->code_off;
ctx->no_fallback = TRUE;
hres = compile_statement(ctx, &catch_ctx, stat->catch_block->statement); hres = compile_statement(ctx, &catch_ctx, stat->catch_block->statement);
ctx->no_fallback = prev_no_fallback;
if(hres == E_NOTIMPL) { if(hres == E_NOTIMPL) {
ctx->code_off = off_backup; ctx->code_off = off_backup;
stat->stat.eval = try_statement_eval; stat->stat.eval = try_statement_eval;
...@@ -1558,9 +1527,7 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat) ...@@ -1558,9 +1527,7 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat)
if(push_instr(ctx, OP_pop) == -1) if(push_instr(ctx, OP_pop) == -1)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
ctx->no_fallback = TRUE;
hres = compile_statement(ctx, stat->catch_block ? NULL : &finally_ctx, stat->finally_statement); hres = compile_statement(ctx, stat->catch_block ? NULL : &finally_ctx, stat->finally_statement);
ctx->no_fallback = prev_no_fallback;
if(hres == E_NOTIMPL) { if(hres == E_NOTIMPL) {
ctx->code_off = off_backup; ctx->code_off = off_backup;
stat->stat.eval = try_statement_eval; stat->stat.eval = try_statement_eval;
......
...@@ -3265,10 +3265,12 @@ HRESULT compiled_statement_eval(script_ctx_t *ctx, statement_t *stat, return_typ ...@@ -3265,10 +3265,12 @@ HRESULT compiled_statement_eval(script_ctx_t *ctx, statement_t *stat, return_typ
exec_ctx->ei = prev_ei; exec_ctx->ei = prev_ei;
exec_ctx->except_frame = prev_except_frame; exec_ctx->except_frame = prev_except_frame;
if(FAILED(hres)) { if(FAILED(hres) || rt->type != RT_NORMAL) {
stack_popn(exec_ctx, exec_ctx->top-prev_top);
while(exec_ctx->scope_chain != prev_scope) while(exec_ctx->scope_chain != prev_scope)
scope_pop(&exec_ctx->scope_chain); scope_pop(&exec_ctx->scope_chain);
}
if(FAILED(hres)) {
stack_popn(exec_ctx, exec_ctx->top-prev_top);
return hres; return hres;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment