Commit c6932d80 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Always use bytecode for try statement.

parent 985c6a19
......@@ -1432,12 +1432,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 finally_ctx = {2, FALSE, FALSE, -1, -1};
unsigned off_backup, push_except;
unsigned push_except;
BSTR ident;
HRESULT hres;
off_backup = ctx->code_off;
push_except = push_instr(ctx, OP_push_except);
if(push_except == -1)
return E_OUTOFMEMORY;
......@@ -1456,11 +1454,6 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat)
try_ctx.stack_use = 2;
hres = compile_statement(ctx, &try_ctx, stat->try_statement);
if(hres == E_NOTIMPL) {
ctx->code_off = off_backup;
stat->stat.eval = try_statement_eval;
return compile_interp_fallback(ctx, &stat->stat);
}
if(FAILED(hres))
return hres;
......@@ -1477,11 +1470,6 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat)
instr_ptr(ctx, push_except)->arg1.uint = ctx->code_off;
hres = compile_statement(ctx, &catch_ctx, stat->catch_block->statement);
if(hres == E_NOTIMPL) {
ctx->code_off = off_backup;
stat->stat.eval = try_statement_eval;
return compile_interp_fallback(ctx, &stat->stat);
}
if(FAILED(hres))
return hres;
......@@ -1499,11 +1487,6 @@ static HRESULT compile_try_statement(compiler_ctx_t *ctx, try_statement_t *stat)
return E_OUTOFMEMORY;
hres = compile_statement(ctx, stat->catch_block ? NULL : &finally_ctx, stat->finally_statement);
if(hres == E_NOTIMPL) {
ctx->code_off = off_backup;
stat->stat.eval = try_statement_eval;
return compile_interp_fallback(ctx, &stat->stat);
}
if(FAILED(hres))
return hres;
......
......@@ -944,69 +944,6 @@ static HRESULT interp_throw_type(exec_ctx_t *ctx)
}
/* ECMA-262 3rd Edition 12.14 */
static HRESULT catch_eval(script_ctx_t *ctx, catch_block_t *block, return_type_t *rt, VARIANT *ret)
{
jsdisp_t *var_disp;
VARIANT ex, val;
HRESULT hres;
ex = rt->ei.var;
memset(&rt->ei, 0, sizeof(jsexcept_t));
hres = create_dispex(ctx, NULL, NULL, &var_disp);
if(SUCCEEDED(hres)) {
hres = jsdisp_propput_name(var_disp, block->identifier, &ex, &rt->ei, NULL/*FIXME*/);
if(SUCCEEDED(hres)) {
hres = scope_push(ctx->exec_ctx->scope_chain, var_disp, &ctx->exec_ctx->scope_chain);
if(SUCCEEDED(hres)) {
hres = stat_eval(ctx, block->statement, rt, &val);
scope_pop(&ctx->exec_ctx->scope_chain);
}
}
jsdisp_release(var_disp);
}
VariantClear(&ex);
if(FAILED(hres))
return hres;
*ret = val;
return S_OK;
}
/* ECMA-262 3rd Edition 12.14 */
HRESULT try_statement_eval(script_ctx_t *ctx, statement_t *_stat, return_type_t *rt, VARIANT *ret)
{
try_statement_t *stat = (try_statement_t*)_stat;
VARIANT val;
HRESULT hres;
TRACE("\n");
hres = stat_eval(ctx, stat->try_statement, rt, &val);
if(FAILED(hres)) {
TRACE("EXCEPTION\n");
if(!stat->catch_block)
return hres;
hres = catch_eval(ctx, stat->catch_block, rt, &val);
if(FAILED(hres))
return hres;
}
if(stat->finally_statement) {
VariantClear(&val);
hres = stat_eval(ctx, stat->finally_statement, rt, &val);
if(FAILED(hres))
return hres;
}
*ret = val;
return S_OK;
}
/* ECMA-262 3rd Edition 12.14 */
static HRESULT interp_push_except(exec_ctx_t *ctx)
{
const unsigned arg1 = ctx->parser->code->instrs[ctx->ip].arg1.uint;
......
......@@ -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 try_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
typedef struct {
enum {
......
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