jscript: Use bytecode for '<<=' expression implementation.

This commit is contained in:
Jacek Caban 2011-12-09 11:05:08 +01:00 committed by Alexandre Julliard
parent a80392e5ea
commit 7c3728d728
4 changed files with 3 additions and 73 deletions

View File

@ -625,6 +625,8 @@ static HRESULT compile_expression_noret(compiler_ctx_t *ctx, expression_t *expr,
return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_mod); return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_mod);
case EXPR_ASSIGNOR: case EXPR_ASSIGNOR:
return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_or); return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_or);
case EXPR_ASSIGNLSHIFT:
return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_lshift);
case EXPR_ASSIGNRSHIFT: case EXPR_ASSIGNRSHIFT:
return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_rshift); return compile_assign_expression(ctx, (binary_expression_t*)expr, OP_rshift);
case EXPR_ASSIGNRRSHIFT: case EXPR_ASSIGNRRSHIFT:

View File

@ -1440,47 +1440,6 @@ static HRESULT binary_expr_eval(script_ctx_t *ctx, binary_expression_t *expr, op
return S_OK; return S_OK;
} }
/* ECMA-262 3rd Edition 11.13.2 */
static HRESULT assign_oper_eval(script_ctx_t *ctx, expression_t *lexpr, expression_t *rexpr, oper_t oper,
jsexcept_t *ei, exprval_t *ret)
{
VARIANT retv, lval, rval;
exprval_t exprval, exprvalr;
HRESULT hres;
hres = expr_eval(ctx, lexpr, EXPR_NEWREF, ei, &exprval);
if(FAILED(hres))
return hres;
hres = exprval_value(ctx, &exprval, ei, &lval);
if(SUCCEEDED(hres)) {
hres = expr_eval(ctx, rexpr, 0, ei, &exprvalr);
if(SUCCEEDED(hres)) {
hres = exprval_value(ctx, &exprvalr, ei, &rval);
exprval_release(&exprvalr);
}
if(SUCCEEDED(hres)) {
hres = oper(ctx, &lval, &rval, ei, &retv);
VariantClear(&rval);
}
VariantClear(&lval);
}
if(SUCCEEDED(hres)) {
hres = put_value(ctx, &exprval, &retv, ei);
if(FAILED(hres))
VariantClear(&retv);
}
exprval_release(&exprval);
if(FAILED(hres))
return hres;
ret->type = EXPRVAL_VARIANT;
ret->u.var = retv;
return S_OK;
}
/* ECMA-262 3rd Edition 13 */ /* ECMA-262 3rd Edition 13 */
HRESULT function_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) HRESULT function_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{ {
@ -3092,26 +3051,6 @@ static HRESULT interp_neg(exec_ctx_t *ctx)
return stack_push_bool(ctx, !b); return stack_push_bool(ctx, !b);
} }
/* ECMA-262 3rd Edition 11.7.1 */
static HRESULT lshift_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsexcept_t *ei, VARIANT *retv)
{
DWORD ri;
INT li;
HRESULT hres;
hres = to_int32(ctx, lval, ei, &li);
if(FAILED(hres))
return hres;
hres = to_uint32(ctx, rval, ei, &ri);
if(FAILED(hres))
return hres;
V_VT(retv) = VT_I4;
V_I4(retv) = li << (ri&0x1f);
return S_OK;
}
/* ECMA-262 3rd Edition 11.7.1 */ /* ECMA-262 3rd Edition 11.7.1 */
static HRESULT interp_lshift(exec_ctx_t *ctx) static HRESULT interp_lshift(exec_ctx_t *ctx)
{ {
@ -3191,16 +3130,6 @@ static HRESULT interp_assign(exec_ctx_t *ctx)
return stack_push(ctx, v); return stack_push(ctx, v);
} }
/* ECMA-262 3rd Edition 11.13.2 */
HRESULT assign_lshift_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
{
binary_expression_t *expr = (binary_expression_t*)_expr;
TRACE("\n");
return assign_oper_eval(ctx, expr->expression1, expr->expression2, lshift_eval, ei, ret);
}
static HRESULT interp_undefined(exec_ctx_t *ctx) static HRESULT interp_undefined(exec_ctx_t *ctx)
{ {
VARIANT v; VARIANT v;

View File

@ -568,7 +568,6 @@ HRESULT property_value_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcep
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 assign_lshift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT compiled_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT compiled_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;

View File

@ -1340,7 +1340,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,
assign_lshift_expression_eval, compiled_expression_eval,
compiled_expression_eval, compiled_expression_eval,
compiled_expression_eval, compiled_expression_eval,
compiled_expression_eval, compiled_expression_eval,