Commit 0f0f76ce authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Allow poping multiple stack values at the time.

parent 10c2a2bb
......@@ -530,8 +530,9 @@ static HRESULT compile_conditional_expression(compiler_ctx_t *ctx, conditional_e
return E_OUTOFMEMORY;
set_arg_uint(ctx, jmp_false, ctx->code_off);
if(!push_instr(ctx, OP_pop))
return E_OUTOFMEMORY;
hres = push_instr_uint(ctx, OP_pop, 1);
if(FAILED(hres))
return hres;
hres = compile_expression(ctx, expr->false_expression, TRUE);
if(FAILED(hres))
......@@ -1053,7 +1054,7 @@ static HRESULT compile_expression(compiler_ctx_t *ctx, expression_t *expr, BOOL
if(FAILED(hres))
return hres;
return emit_ret || push_instr(ctx, OP_pop) ? S_OK : E_OUTOFMEMORY;
return emit_ret ? S_OK : push_instr_uint(ctx, OP_pop, 1);
}
static inline BOOL is_loop_statement(statement_type_t type)
......@@ -1353,12 +1354,12 @@ static HRESULT pop_to_stat(compiler_ctx_t *ctx, BOOL var_stack, BOOL scope_stack
stack_pop += iter->stack_use;
}
if(var_stack) {
/* FIXME: optimize */
while(stack_pop--) {
if(!push_instr(ctx, OP_pop))
return E_OUTOFMEMORY;
}
if(var_stack && stack_pop) {
HRESULT hres;
hres = push_instr_uint(ctx, OP_pop, stack_pop);
if(FAILED(hres))
return hres;
}
return S_OK;
......@@ -1579,12 +1580,11 @@ static HRESULT compile_switch_statement(compiler_ctx_t *ctx, switch_statement_t
}
if(SUCCEEDED(hres)) {
if(push_instr(ctx, OP_pop)) {
hres = push_instr_uint(ctx, OP_pop, 1);
if(SUCCEEDED(hres)) {
default_jmp = push_instr(ctx, OP_jmp);
if(!default_jmp)
hres = E_OUTOFMEMORY;
}else {
hres = E_OUTOFMEMORY;
}
}
......
......@@ -2339,9 +2339,11 @@ static HRESULT interp_jmp_z(exec_ctx_t *ctx)
static HRESULT interp_pop(exec_ctx_t *ctx)
{
TRACE("\n");
const unsigned arg = get_op_uint(ctx, 0);
stack_popn(ctx, 1);
TRACE("%u\n", arg);
stack_popn(ctx, arg);
return S_OK;
}
......
......@@ -84,7 +84,7 @@ typedef struct {
X(null, 1, 0,0) \
X(obj_prop, 1, ARG_BSTR, 0) \
X(or, 1, 0,0) \
X(pop, 1, 0,0) \
X(pop, 1, ARG_UINT, 0) \
X(pop_except, 1, 0,0) \
X(pop_scope, 1, 0,0) \
X(postinc, 1, ARG_INT, 0) \
......
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