jscript: Use bytecode for '>>' expression.
This commit is contained in:
parent
fc4948af2c
commit
28013dfa6f
|
@ -689,6 +689,8 @@ static HRESULT compile_expression_noret(compiler_ctx_t *ctx, expression_t *expr,
|
||||||
return compile_increment_expression(ctx, (unary_expression_t*)expr, OP_preinc, -1);
|
return compile_increment_expression(ctx, (unary_expression_t*)expr, OP_preinc, -1);
|
||||||
case EXPR_PREINC:
|
case EXPR_PREINC:
|
||||||
return compile_increment_expression(ctx, (unary_expression_t*)expr, OP_preinc, 1);
|
return compile_increment_expression(ctx, (unary_expression_t*)expr, OP_preinc, 1);
|
||||||
|
case EXPR_RSHIFT:
|
||||||
|
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_rshift);
|
||||||
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:
|
||||||
|
|
|
@ -174,6 +174,11 @@ static inline HRESULT stack_pop_int(exec_ctx_t *ctx, INT *r)
|
||||||
return to_int32(ctx->parser->script, stack_pop(ctx), &ctx->ei, r);
|
return to_int32(ctx->parser->script, stack_pop(ctx), &ctx->ei, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline HRESULT stack_pop_uint(exec_ctx_t *ctx, DWORD *r)
|
||||||
|
{
|
||||||
|
return to_uint32(ctx->parser->script, stack_pop(ctx), &ctx->ei, r);
|
||||||
|
}
|
||||||
|
|
||||||
static inline IDispatch *stack_pop_objid(exec_ctx_t *ctx, DISPID *id)
|
static inline IDispatch *stack_pop_objid(exec_ctx_t *ctx, DISPID *id)
|
||||||
{
|
{
|
||||||
assert(V_VT(stack_top(ctx)) == VT_INT && V_VT(stack_topn(ctx, 1)) == VT_DISPATCH);
|
assert(V_VT(stack_top(ctx)) == VT_INT && V_VT(stack_topn(ctx, 1)) == VT_DISPATCH);
|
||||||
|
@ -3134,6 +3139,24 @@ static HRESULT rshift_eval(script_ctx_t *ctx, VARIANT *lval, VARIANT *rval, jsex
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ECMA-262 3rd Edition 11.7.2 */
|
||||||
|
static HRESULT interp_rshift(exec_ctx_t *ctx)
|
||||||
|
{
|
||||||
|
DWORD r;
|
||||||
|
INT l;
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = stack_pop_uint(ctx, &r);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
hres = stack_pop_int(ctx, &l);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
|
||||||
|
return stack_push_int(ctx, l >> (r&0x1f));
|
||||||
|
}
|
||||||
|
|
||||||
/* ECMA-262 3rd Edition 11.7.2 */
|
/* ECMA-262 3rd Edition 11.7.2 */
|
||||||
HRESULT right_shift_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
HRESULT right_shift_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags, jsexcept_t *ei, exprval_t *ret)
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,6 +82,7 @@ typedef struct _func_stack {
|
||||||
X(postinc, 1, ARG_INT, 0) \
|
X(postinc, 1, ARG_INT, 0) \
|
||||||
X(preinc, 1, ARG_INT, 0) \
|
X(preinc, 1, ARG_INT, 0) \
|
||||||
X(regexp, 1, ARG_STR, ARG_INT) \
|
X(regexp, 1, ARG_STR, ARG_INT) \
|
||||||
|
X(rshift, 1, 0,0) \
|
||||||
X(str, 1, ARG_STR, 0) \
|
X(str, 1, ARG_STR, 0) \
|
||||||
X(this, 1, 0,0) \
|
X(this, 1, 0,0) \
|
||||||
X(throw, 0, ARG_UINT, 0) \
|
X(throw, 0, ARG_UINT, 0) \
|
||||||
|
@ -566,7 +567,6 @@ HRESULT instanceof_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*
|
||||||
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 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;
|
||||||
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;
|
HRESULT right2_shift_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 assign_lshift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
|
||||||
HRESULT assign_rshift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
|
HRESULT assign_rshift_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -1337,7 +1337,7 @@ static const expression_eval_t expression_eval_table[] = {
|
||||||
compiled_expression_eval,
|
compiled_expression_eval,
|
||||||
compiled_expression_eval,
|
compiled_expression_eval,
|
||||||
left_shift_expression_eval,
|
left_shift_expression_eval,
|
||||||
right_shift_expression_eval,
|
compiled_expression_eval,
|
||||||
right2_shift_expression_eval,
|
right2_shift_expression_eval,
|
||||||
compiled_expression_eval,
|
compiled_expression_eval,
|
||||||
assign_lshift_expression_eval,
|
assign_lshift_expression_eval,
|
||||||
|
|
Loading…
Reference in New Issue