jscript: Use bytecode for bool literal implementation.
This commit is contained in:
parent
b3feafab41
commit
13d96df4bd
|
@ -121,6 +121,8 @@ static HRESULT compile_literal(compiler_ctx_t *ctx, literal_expression_t *expr)
|
|||
literal_t *literal = expr->literal;
|
||||
|
||||
switch(literal->type) {
|
||||
case LT_BOOL:
|
||||
return push_instr_int(ctx, OP_bool, literal->u.bval);
|
||||
case LT_INT:
|
||||
return push_instr_int(ctx, OP_int, literal->u.lval);
|
||||
default:
|
||||
|
|
|
@ -1724,6 +1724,16 @@ HRESULT identifier_expression_eval(script_ctx_t *ctx, expression_t *_expr, DWORD
|
|||
return hres;
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 7.8.2 */
|
||||
HRESULT interp_bool(exec_ctx_t *ctx)
|
||||
{
|
||||
const LONG arg = ctx->parser->code->instrs[ctx->ip].arg1.lng;
|
||||
|
||||
TRACE("%s\n", arg ? "true" : "false");
|
||||
|
||||
return stack_push_bool(ctx, arg);
|
||||
}
|
||||
|
||||
/* ECMA-262 3rd Edition 7.8.3 */
|
||||
HRESULT interp_int(exec_ctx_t *ctx)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@ typedef struct _func_stack {
|
|||
|
||||
#define OP_LIST \
|
||||
X(add, 1, 0) \
|
||||
X(bool, 1, 0) \
|
||||
X(bneg, 1, 0) \
|
||||
X(eq2, 1, 0) \
|
||||
X(in, 1, 0) \
|
||||
|
|
Loading…
Reference in New Issue