Commit 83667e74 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Use bytecode for this expression implementation.

parent 9050c372
...@@ -223,6 +223,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr) ...@@ -223,6 +223,8 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr)
return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_neq2); return compile_binary_expression(ctx, (binary_expression_t*)expr, OP_neq2);
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_THIS:
return push_instr(ctx, OP_this) == -1 ? E_OUTOFMEMORY : S_OK;
default: default:
assert(expr->eval != compiled_expression_eval); assert(expr->eval != compiled_expression_eval);
return compile_interp_fallback(ctx, expr); return compile_interp_fallback(ctx, expr);
......
...@@ -1694,15 +1694,16 @@ HRESULT call_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags ...@@ -1694,15 +1694,16 @@ HRESULT call_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD flags
} }
/* ECMA-262 3rd Edition 11.1.1 */ /* ECMA-262 3rd Edition 11.1.1 */
HRESULT this_expression_eval(script_ctx_t *ctx, expression_t *expr, DWORD flags, jsexcept_t *ei, exprval_t *ret) HRESULT interp_this(exec_ctx_t *ctx)
{ {
VARIANT v;
TRACE("\n"); TRACE("\n");
ret->type = EXPRVAL_VARIANT; V_VT(&v) = VT_DISPATCH;
V_VT(&ret->u.var) = VT_DISPATCH; V_DISPATCH(&v) = ctx->this_obj;
V_DISPATCH(&ret->u.var) = ctx->exec_ctx->this_obj; IDispatch_AddRef(ctx->this_obj);
IDispatch_AddRef(ctx->exec_ctx->this_obj); return stack_push(ctx, &v);
return S_OK;
} }
/* ECMA-262 3rd Edition 10.1.4 */ /* ECMA-262 3rd Edition 10.1.4 */
......
...@@ -54,6 +54,7 @@ typedef struct _func_stack { ...@@ -54,6 +54,7 @@ typedef struct _func_stack {
X(null, 1, 0,0) \ X(null, 1, 0,0) \
X(regexp, 1, ARG_STR, ARG_INT) \ X(regexp, 1, ARG_STR, ARG_INT) \
X(str, 1, ARG_STR, 0) \ X(str, 1, ARG_STR, 0) \
X(this, 1, 0,0) \
X(tonum, 1, 0,0) \ X(tonum, 1, 0,0) \
X(tree, 1, ARG_EXPR, 0) \ X(tree, 1, ARG_EXPR, 0) \
X(ret, 0, 0,0) X(ret, 0, 0,0)
...@@ -528,7 +529,6 @@ HRESULT array_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,expr ...@@ -528,7 +529,6 @@ HRESULT array_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,expr
HRESULT member_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT member_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT new_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT new_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT call_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT call_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT this_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT identifier_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT identifier_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT array_literal_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT array_literal_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
HRESULT property_value_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN; HRESULT property_value_expression_eval(script_ctx_t*,expression_t*,DWORD,jsexcept_t*,exprval_t*) DECLSPEC_HIDDEN;
......
...@@ -1357,7 +1357,7 @@ static const expression_eval_t expression_eval_table[] = { ...@@ -1357,7 +1357,7 @@ static const expression_eval_t expression_eval_table[] = {
member_expression_eval, member_expression_eval,
new_expression_eval, new_expression_eval,
call_expression_eval, call_expression_eval,
this_expression_eval, compiled_expression_eval,
function_expression_eval, function_expression_eval,
identifier_expression_eval, identifier_expression_eval,
array_literal_expression_eval, array_literal_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