jscript: Use bytecode for '*' expression implementation.

This commit is contained in:
Jacek Caban 2011-11-29 11:08:54 +01:00 committed by Alexandre Julliard
parent 29fddd83ff
commit cf68237c80
4 changed files with 16 additions and 5 deletions

View File

@ -364,6 +364,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr)
return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_neg);
case EXPR_MINUS:
return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_minus);
case EXPR_MUL:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_mul);
case EXPR_NEW:
return compile_new_expression(ctx, (call_expression_t*)expr);
case EXPR_NOTEQ:

View File

@ -2323,13 +2323,22 @@ static HRESULT mul_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcep
}
/* ECMA-262 3rd Edition 11.5.1 */
HRESULT mul_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
HRESULT interp_mul(exec_ctx_t *ctx)
{
binary_expression_t *expr = (binary_expression_t*)_expr;
VARIANT l, r;
HRESULT hres;
TRACE("\n");
return binary_expr_eval(ctx, expr, mul_eval, ei, ret);
hres = stack_pop_number(ctx, &r);
if(FAILED(hres))
return hres;
hres = stack_pop_number(ctx, &l);
if(FAILED(hres))
return hres;
return stack_push_number(ctx, num_val(&l)*num_val(&r));
}
/* ECMA-262 3rd Edition 11.5.2 */

View File

@ -55,6 +55,7 @@ typedef struct _func_stack {
X(jmp_nz, 0, ARG_ADDR, 0) \
X(jmp_z, 0, ARG_ADDR, 0) \
X(minus, 1, 0,0) \
X(mul, 1, 0,0) \
X(neg, 1, 0,0) \
X(neq, 1, 0,0) \
X(neq2, 1, 0,0) \
@ -555,7 +556,6 @@ HRESULT binary_or_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,
HRESULT binary_xor_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT binary_and_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT instanceof_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT mul_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT div_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT mod_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT delete_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;

View File

@ -1315,7 +1315,7 @@ static const expression_eval_t expression_eval_table[] = {
compiled_expression_eval,
compiled_expression_eval,
compiled_expression_eval,
mul_expression_eval,
compiled_expression_eval,
div_expression_eval,
mod_expression_eval,
delete_expression_eval,