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

jscript: Use bytecode for post-decrement expression.

parent a508149f
...@@ -292,7 +292,7 @@ static HRESULT compile_memberid_expression(compiler_ctx_t *ctx, expression_t *ex ...@@ -292,7 +292,7 @@ static HRESULT compile_memberid_expression(compiler_ctx_t *ctx, expression_t *ex
return hres; return hres;
} }
static HRESULT compile_increment_expression(compiler_ctx_t *ctx, unary_expression_t *expr) static HRESULT compile_increment_expression(compiler_ctx_t *ctx, unary_expression_t *expr, int n)
{ {
HRESULT hres; HRESULT hres;
...@@ -308,7 +308,7 @@ static HRESULT compile_increment_expression(compiler_ctx_t *ctx, unary_expressio ...@@ -308,7 +308,7 @@ static HRESULT compile_increment_expression(compiler_ctx_t *ctx, unary_expressio
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
return push_instr_int(ctx, OP_postinc, 1); return push_instr_int(ctx, OP_postinc, n);
} }
/* ECMA-262 3rd Edition 11.14 */ /* ECMA-262 3rd Edition 11.14 */
...@@ -647,8 +647,10 @@ static HRESULT compile_expression_noret(compiler_ctx_t *ctx, expression_t *expr, ...@@ -647,8 +647,10 @@ static HRESULT compile_expression_noret(compiler_ctx_t *ctx, expression_t *expr,
return compile_logical_expression(ctx, (binary_expression_t*)expr, OP_jmp_nz); return compile_logical_expression(ctx, (binary_expression_t*)expr, OP_jmp_nz);
case EXPR_PLUS: case EXPR_PLUS:
return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_tonum); return compile_unary_expression(ctx, (unary_expression_t*)expr, OP_tonum);
case EXPR_POSTDEC:
return compile_increment_expression(ctx, (unary_expression_t*)expr, -1);
case EXPR_POSTINC: case EXPR_POSTINC:
return compile_increment_expression(ctx, (unary_expression_t*)expr); return compile_increment_expression(ctx, (unary_expression_t*)expr, 1);
case EXPR_SUB: case EXPR_SUB:
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_sub); return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_sub);
case EXPR_THIS: case EXPR_THIS:
......
...@@ -2735,41 +2735,6 @@ static HRESULT interp_postinc(exec_ctx_t *ctx) ...@@ -2735,41 +2735,6 @@ static HRESULT interp_postinc(exec_ctx_t *ctx)
return stack_push(ctx, &v); return stack_push(ctx, &v);
} }
/* ECMA-262 3rd Edition 11.3.2 */
HRESULT post_decrement_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
unary_expression_t *expr = (unary_expression_t*)_expr;
VARIANT val, num;
exprval_t exprval;
HRESULT hres;
TRACE("\n");
hres = expr_eval(ctx, expr->expression, EXPR_NEWREF, ei, &exprval);
if(FAILED(hres))
return hres;
hres = exprval_value(ctx, &exprval, ei, &val);
if(SUCCEEDED(hres)) {
hres = to_number(ctx, &val, ei, &num);
VariantClear(&val);
}
if(SUCCEEDED(hres)) {
VARIANT dec;
num_set_val(&dec, num_val(&num)-1.0);
hres = put_value(ctx, &exprval, &dec, ei);
}
exprval_release(&exprval);
if(FAILED(hres))
return hres;
ret->type = EXPRVAL_VARIANT;
ret->u.var = num;
return S_OK;
}
/* ECMA-262 3rd Edition 11.4.4 */ /* ECMA-262 3rd Edition 11.4.4 */
HRESULT pre_increment_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) HRESULT pre_increment_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{ {
......
...@@ -563,7 +563,6 @@ HRESULT binary_and_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t* ...@@ -563,7 +563,6 @@ HRESULT binary_and_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*
HRESULT instanceof_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 delete_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;
HRESULT typeof_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT typeof_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT post_decrement_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT pre_increment_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT pre_increment_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT pre_decrement_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT pre_decrement_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT left_shift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT left_shift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
......
...@@ -1323,7 +1323,7 @@ static const expression_eval_t expression_eval_table[] = { ...@@ -1323,7 +1323,7 @@ static const expression_eval_t expression_eval_table[] = {
compiled_expression_eval, compiled_expression_eval,
compiled_expression_eval, compiled_expression_eval,
compiled_expression_eval, compiled_expression_eval,
post_decrement_expression_eval, compiled_expression_eval,
pre_increment_expression_eval, pre_increment_expression_eval,
pre_decrement_expression_eval, pre_decrement_expression_eval,
compiled_expression_eval, compiled_expression_eval,
......
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