Jacek Caban : jscript: Always use bytecode for try statement.
Alexandre Julliard
julliard at winehq.org
Thu Dec 29 12:15:45 CST 2011
Module: wine
Branch: master
Commit: c6932d8069335a8da436244e7fbee678667129c9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=c6932d8069335a8da436244e7fbee678667129c9
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Dec 29 11:07:22 2011 +0100
jscript: Always use bytecode for try statement.
---
dlls/jscript/compile.c | 19 +-------------
dlls/jscript/engine.c | 63 ------------------------------------------------
dlls/jscript/engine.h | 1 -
3 files changed, 1 insertions(+), 82 deletions(-)
diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index 076b768..636cdff 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -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;
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 746002f..62fdf23 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -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;
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index 385778e..424000e 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 try_statement_eval(script_ctx_t*,statement_t*,return_type_t*,VARIANT*) DECLSPEC_HIDDEN;
typedef struct {
enum {
More information about the wine-cvs
mailing list