Jacek Caban : jscript: Use bytecode for pre-decrement implementation.
Alexandre Julliard
julliard at winehq.org
Thu Dec 8 13:43:38 CST 2011
Module: wine
Branch: master
Commit: 4d0e360266315bf9f32567520d26cb0eedea1824
URL: http://source.winehq.org/git/wine.git/?a=commit;h=4d0e360266315bf9f32567520d26cb0eedea1824
Author: Jacek Caban <jacek at codeweavers.com>
Date: Thu Dec 8 12:02:23 2011 +0100
jscript: Use bytecode for pre-decrement implementation.
---
dlls/jscript/compile.c | 2 ++
dlls/jscript/engine.c | 36 +-----------------------------------
dlls/jscript/engine.h | 1 -
dlls/jscript/parser.y | 2 +-
4 files changed, 4 insertions(+), 37 deletions(-)
diff --git a/dlls/jscript/compile.c b/dlls/jscript/compile.c
index c3e845e..483c9de 100644
--- a/dlls/jscript/compile.c
+++ b/dlls/jscript/compile.c
@@ -651,6 +651,8 @@ static HRESULT compile_expression_noret(compiler_ctx_t *ctx, expression_t *expr,
return compile_increment_expression(ctx, (unary_expression_t*)expr, OP_postinc, -1);
case EXPR_POSTINC:
return compile_increment_expression(ctx, (unary_expression_t*)expr, OP_postinc, 1);
+ case EXPR_PREDEC:
+ return compile_increment_expression(ctx, (unary_expression_t*)expr, OP_preinc, -1);
case EXPR_PREINC:
return compile_increment_expression(ctx, (unary_expression_t*)expr, OP_preinc, 1);
case EXPR_SUB:
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index d2c07f1..467d686 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -2735,7 +2735,7 @@ static HRESULT interp_postinc(exec_ctx_t *ctx)
return stack_push(ctx, &v);
}
-/* ECMA-262 3rd Edition 11.4.4 */
+/* ECMA-262 3rd Edition 11.4.4, 11.4.5 */
static HRESULT interp_preinc(exec_ctx_t *ctx)
{
const int arg = ctx->parser->code->instrs[ctx->ip].arg1.lng;
@@ -2768,40 +2768,6 @@ static HRESULT interp_preinc(exec_ctx_t *ctx)
return stack_push(ctx, &v);
}
-/* ECMA-262 3rd Edition 11.4.5 */
-HRESULT pre_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)) {
- num_set_val(&val, num_val(&num)-1.0);
- hres = put_value(ctx, &exprval, &val, ei);
- }
-
- exprval_release(&exprval);
- if(FAILED(hres))
- return hres;
-
- ret->type = EXPRVAL_VARIANT;
- ret->u.var = val;
- return S_OK;
-}
-
/* ECMA-262 3rd Edition 11.9.3 */
static HRESULT equal_values(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_t *ei, BOOL *ret)
{
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index e3672a4..dab692f 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -564,7 +564,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 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 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 right_shift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT right2_shift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y
index 1b053a0..4fbd678 100644
--- a/dlls/jscript/parser.y
+++ b/dlls/jscript/parser.y
@@ -1325,7 +1325,7 @@ static const expression_eval_t expression_eval_table[] = {
compiled_expression_eval,
compiled_expression_eval,
compiled_expression_eval,
- pre_decrement_expression_eval,
+ compiled_expression_eval,
compiled_expression_eval,
compiled_expression_eval,
compiled_expression_eval,
More information about the wine-cvs
mailing list