jscript: Invoke bytecode directly from expr_eval.

This commit is contained in:
Jacek Caban 2011-12-16 11:44:27 +01:00 committed by Alexandre Julliard
parent fecc2fcb5e
commit 6b1077e2cb
2 changed files with 8 additions and 22 deletions

View File

@ -54,10 +54,7 @@ static inline HRESULT stat_eval(script_ctx_t *ctx, statement_t *stat, return_typ
return stat->eval(ctx, stat, rt, ret); return stat->eval(ctx, stat, rt, ret);
} }
static inline HRESULT expr_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) static HRESULT expr_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*);
{
return compiled_expression_eval(ctx, expr, flags, ei, ret);
}
static HRESULT stack_push(exec_ctx_t *ctx, VARIANT *v) static HRESULT stack_push(exec_ctx_t *ctx, VARIANT *v)
{ {
@ -3122,7 +3119,7 @@ OP_LIST
#undef X #undef X
}; };
static HRESULT interp_expression_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) static HRESULT expr_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{ {
exec_ctx_t *exec_ctx = ctx->exec_ctx; exec_ctx_t *exec_ctx = ctx->exec_ctx;
unsigned prev_ip, prev_top; unsigned prev_ip, prev_top;
@ -3131,6 +3128,12 @@ static HRESULT interp_expression_eval(script_ctx_t *ctx, expression_t *expr, DWO
TRACE("\n"); TRACE("\n");
if(expr->instr_off == -1) {
hres = compile_subscript(ctx->exec_ctx->parser, expr, !(flags & EXPR_NOVAL), &expr->instr_off);
if(FAILED(hres))
return hres;
}
prev_top = exec_ctx->top; prev_top = exec_ctx->top;
prev_ip = exec_ctx->ip; prev_ip = exec_ctx->ip;
exec_ctx->ip = expr->instr_off; exec_ctx->ip = expr->instr_off;
@ -3161,18 +3164,3 @@ static HRESULT interp_expression_eval(script_ctx_t *ctx, expression_t *expr, DWO
ret->u.var = *stack_pop(exec_ctx); ret->u.var = *stack_pop(exec_ctx);
return S_OK; return S_OK;
} }
HRESULT compiled_expression_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
HRESULT hres;
TRACE("\n");
if(expr->instr_off == -1) {
hres = compile_subscript(ctx->exec_ctx->parser, expr, !(flags & EXPR_NOVAL), &expr->instr_off);
if(FAILED(hres))
return hres;
}
return interp_expression_eval(ctx, expr, flags, ei, ret);
}

View File

@ -567,6 +567,4 @@ typedef struct {
prop_val_t *property_list; prop_val_t *property_list;
} property_value_expression_t; } property_value_expression_t;
HRESULT compiled_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT compile_subscript(parser_ctx_t*,expression_t*,BOOL,unsigned*) DECLSPEC_HIDDEN; HRESULT compile_subscript(parser_ctx_t*,expression_t*,BOOL,unsigned*) DECLSPEC_HIDDEN;