ref: e01b4d02c0312f6ddc5b03adb78ed806d1eb22bb
parent: 7228ec51c423cd57413c2c1c9b65b288d0189f5b
author: Tor Andersson <tor@ccxvii.net>
date: Thu Jan 16 12:10:13 EST 2014
Beautify opcode dumping format.
--- a/jsdump.c
+++ b/jsdump.c
@@ -595,7 +595,7 @@
short *end = F->code + F->codelen;
int i;
- printf("function %p %s(", F, F->name);
+ printf("function %p %s (", F, F->name);
for (i = 0; i < F->numparams; ++i)
printf("%s%s", i > 0 ? ", " : "", F->params[i]);
printf(")\n");
@@ -608,10 +608,11 @@
for (i = 0; i < F->numlen; ++i)
printf("\tnumber %.9g\n", F->numtab[i]);
+ printf("{\n");
while (p < end) {
int c = *p++;
- printf("%04d: ", (int)(p - F->code) - 1);
+ printf("% 5d: ", (int)(p - F->code) - 1);
ps(opname[c]);
switch (c) {
@@ -647,6 +648,7 @@
nl();
}
+ printf("}\n");
for (i = 0; i < F->funlen; ++i) {
if (F->funtab[i] != F) {
--- a/jsload.c
+++ b/jsload.c
@@ -9,9 +9,9 @@
js_Ast *prog = jsP_parse(J, filename, source);
if (prog) {
js_Function *fun;
- //jsP_optimize(J, prog);
+ jsP_optimize(J, prog);
//jsP_dumpsyntax(J, prog);
- jsP_dumplist(J, prog);
+ //jsP_dumplist(J, prog);
fun = jsC_compile(J, prog);
if (fun) {
jsC_dumpfunction(J, fun);