Skip to content

Commit

Permalink
squash! review
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Nov 10, 2023
1 parent 6d5695d commit 0b890ab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
10 changes: 6 additions & 4 deletions quickjs-opcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,20 @@ DEF( typeof, 1, 1, 1, none)
DEF( delete, 1, 2, 1, none)
DEF( delete_var, 5, 0, 1, atom)

/* warning: order matters (see js_parse_assign_expr) */
DEF( mul, 1, 2, 1, none)
DEF( div, 1, 2, 1, none)
DEF( mod, 1, 2, 1, none)
DEF( add, 1, 2, 1, none)
DEF( sub, 1, 2, 1, none)
DEF( pow, 1, 2, 1, none)
DEF( shl, 1, 2, 1, none)
DEF( sar, 1, 2, 1, none)
DEF( shr, 1, 2, 1, none)
DEF( and, 1, 2, 1, none)
DEF( xor, 1, 2, 1, none)
DEF( or, 1, 2, 1, none)
DEF( pow, 1, 2, 1, none)

DEF( lt, 1, 2, 1, none)
DEF( lte, 1, 2, 1, none)
DEF( gt, 1, 2, 1, none)
Expand All @@ -252,9 +257,6 @@ DEF( eq, 1, 2, 1, none)
DEF( neq, 1, 2, 1, none)
DEF( strict_eq, 1, 2, 1, none)
DEF( strict_neq, 1, 2, 1, none)
DEF( and, 1, 2, 1, none)
DEF( xor, 1, 2, 1, none)
DEF( or, 1, 2, 1, none)
DEF(is_undefined_or_null, 1, 1, 1, none)
/* must be the last non short and non temporary opcode */
DEF( nop, 1, 0, 0, none)
Expand Down
14 changes: 3 additions & 11 deletions quickjs.c
Original file line number Diff line number Diff line change
Expand Up @@ -18740,12 +18740,11 @@ static __exception int next_token(JSParseState *s)
{
JSValue ret;
const uint8_t *p1;
int flags, radix;
int flags;
flags = ATOD_ACCEPT_BIN_OCT | ATOD_ACCEPT_LEGACY_OCTAL |
ATOD_ACCEPT_UNDERSCORES | ATOD_ACCEPT_SUFFIX;
radix = 0;
s->token.u.num.exponent = 0;
ret = js_atof2(s->ctx, (const char *)p, (const char **)&p, radix,
ret = js_atof2(s->ctx, (const char *)p, (const char **)&p, 0,
flags, &s->token.u.num.exponent);
if (JS_IsException(ret))
goto fail;
Expand Down Expand Up @@ -23261,14 +23260,7 @@ static __exception int js_parse_assign_expr2(JSParseState *s, int parse_flags)
set_object_name(s, name);
}
} else {
static const uint8_t assign_opcodes[] = {
OP_mul, OP_div, OP_mod, OP_add, OP_sub,
OP_shl, OP_sar, OP_shr, OP_and, OP_xor, OP_or,
OP_pow,
OP_pow,
};
op = assign_opcodes[op - TOK_MUL_ASSIGN];
emit_op(s, op);
emit_op(s, op - TOK_MUL_ASSIGN + OP_mul);
}
put_lvalue(s, opcode, scope, name, label, PUT_LVALUE_KEEP_TOP, FALSE);
} else if (op >= TOK_LAND_ASSIGN && op <= TOK_DOUBLE_QUESTION_MARK_ASSIGN) {
Expand Down

0 comments on commit 0b890ab

Please sign in to comment.