Skip to content

Commit f181b3e

Browse files
authored
Remove dead code (#155)
1 parent 6997445 commit f181b3e

File tree

1 file changed

+0
-84
lines changed

1 file changed

+0
-84
lines changed

quickjs.c

Lines changed: 0 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -6061,7 +6061,6 @@ void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt)
60616061
{
60626062
fprintf(fp, "QuickJS-ng memory usage -- %s version, %d-bit, malloc limit: %"PRId64"\n\n",
60636063
JS_GetVersion(), (int)sizeof(void *) * 8, (int64_t)(ssize_t)s->malloc_limit);
6064-
#if 1
60656064
if (rt) {
60666065
static const struct {
60676066
const char *name;
@@ -6117,7 +6116,6 @@ void JS_DumpMemoryUsage(FILE *fp, const JSMemoryUsage *s, JSRuntime *rt)
61176116
}
61186117
fprintf(fp, "\n");
61196118
}
6120-
#endif
61216119
fprintf(fp, "%-20s %8s %8s\n", "NAME", "COUNT", "SIZE");
61226120

61236121
if (s->malloc_count) {
@@ -21557,33 +21555,7 @@ static __exception int js_parse_array_literal(JSParseState *s)
2155721555
return -1;
2155821556
if (js_parse_assign_expr(s))
2155921557
return -1;
21560-
#if 1
2156121558
emit_op(s, OP_append);
21562-
#else
21563-
int label_next, label_done;
21564-
label_next = new_label(s);
21565-
label_done = new_label(s);
21566-
/* enumerate object */
21567-
emit_op(s, OP_for_of_start);
21568-
emit_op(s, OP_rot5l);
21569-
emit_op(s, OP_rot5l);
21570-
emit_label(s, label_next);
21571-
/* on stack: enum_rec array idx */
21572-
emit_op(s, OP_for_of_next);
21573-
emit_u8(s, 2);
21574-
emit_goto(s, OP_if_true, label_done);
21575-
/* append element */
21576-
/* enum_rec array idx val -> enum_rec array new_idx */
21577-
emit_op(s, OP_define_array_el);
21578-
emit_op(s, OP_inc);
21579-
emit_goto(s, OP_goto, label_next);
21580-
emit_label(s, label_done);
21581-
/* close enumeration */
21582-
emit_op(s, OP_drop); /* drop undef val */
21583-
emit_op(s, OP_nip1); /* drop enum_rec */
21584-
emit_op(s, OP_nip1);
21585-
emit_op(s, OP_nip1);
21586-
#endif
2158721559
} else {
2158821560
need_length = TRUE;
2158921561
if (s->token.val != ',') {
@@ -22861,34 +22833,8 @@ static __exception int js_parse_postfix_expr(JSParseState *s, int parse_flags)
2286122833
return -1;
2286222834
if (js_parse_assign_expr(s))
2286322835
return -1;
22864-
#if 1
2286522836
/* XXX: could pass is_last indicator? */
2286622837
emit_op(s, OP_append);
22867-
#else
22868-
int label_next, label_done;
22869-
label_next = new_label(s);
22870-
label_done = new_label(s);
22871-
/* push enumerate object below array/idx pair */
22872-
emit_op(s, OP_for_of_start);
22873-
emit_op(s, OP_rot5l);
22874-
emit_op(s, OP_rot5l);
22875-
emit_label(s, label_next);
22876-
/* on stack: enum_rec array idx */
22877-
emit_op(s, OP_for_of_next);
22878-
emit_u8(s, 2);
22879-
emit_goto(s, OP_if_true, label_done);
22880-
/* append element */
22881-
/* enum_rec array idx val -> enum_rec array new_idx */
22882-
emit_op(s, OP_define_array_el);
22883-
emit_op(s, OP_inc);
22884-
emit_goto(s, OP_goto, label_next);
22885-
emit_label(s, label_done);
22886-
/* close enumeration, drop enum_rec and idx */
22887-
emit_op(s, OP_drop); /* drop undef */
22888-
emit_op(s, OP_nip1); /* drop enum_rec */
22889-
emit_op(s, OP_nip1);
22890-
emit_op(s, OP_nip1);
22891-
#endif
2289222838
} else {
2289322839
if (js_parse_assign_expr(s))
2289422840
return -1;
@@ -24066,7 +24012,6 @@ static int is_let(JSParseState *s, int decl_mask)
2406624012
int res = FALSE;
2406724013

2406824014
if (token_is_pseudo_keyword(s, JS_ATOM_let)) {
24069-
#if 1
2407024015
JSParsePos pos;
2407124016
js_parse_get_pos(s, &pos);
2407224017
for (;;) {
@@ -24099,12 +24044,6 @@ static int is_let(JSParseState *s, int decl_mask)
2409924044
if (js_parse_seek_token(s, &pos)) {
2410024045
res = -1;
2410124046
}
24102-
#else
24103-
int tok = peek_token(s, TRUE);
24104-
if (tok == '{' || tok == TOK_IDENT || peek_token(s, FALSE) == '[') {
24105-
res = TRUE;
24106-
}
24107-
#endif
2410824047
}
2410924048
return res;
2411024049
}
@@ -29044,29 +28983,6 @@ static __exception int resolve_variables(JSContext *ctx, JSFunctionDef *s)
2904428983
}
2904528984
}
2904628985
goto no_change;
29047-
case OP_drop:
29048-
if (0) {
29049-
/* remove drops before return_undef */
29050-
/* do not perform this optimization in pass2 because
29051-
it breaks patterns recognised in resolve_labels */
29052-
int pos1 = pos_next;
29053-
int line1 = line_num;
29054-
while (code_match(&cc, pos1, OP_drop, -1)) {
29055-
if (cc.line_num >= 0) line1 = cc.line_num;
29056-
pos1 = cc.pos;
29057-
}
29058-
if (code_match(&cc, pos1, OP_return_undef, -1)) {
29059-
pos_next = pos1;
29060-
if (line1 != -1 && line1 != line_num) {
29061-
line_num = line1;
29062-
s->line_number_size++;
29063-
dbuf_putc(&bc_out, OP_line_num);
29064-
dbuf_put_u32(&bc_out, line_num);
29065-
}
29066-
break;
29067-
}
29068-
}
29069-
goto no_change;
2907028986
case OP_insert3:
2907128987
/* Transformation: insert3 put_array_el|put_ref_value drop -> put_array_el|put_ref_value */
2907228988
if (code_match(&cc, pos_next, M2(OP_put_array_el, OP_put_ref_value), OP_drop, -1)) {

0 commit comments

Comments
 (0)