📄 asm.js
字号:
this.stack_delta = -1;
this.size = 1;
this.print = JSC$ASM_shift_left_print;
this.link = JSC$asm_link;
}
function JSC$ASM_shift_left_print (stream)
{
stream.write ("\tshift_left\n");
}
/* shift_right */
function JSC$ASM_shift_right (ln)
{
this.type = JSC$OP_SHIFT_RIGHT;
this.linenum = ln;
this.stack_delta = -1;
this.size = 1;
this.print = JSC$ASM_shift_right_print;
this.link = JSC$asm_link;
}
function JSC$ASM_shift_right_print (stream)
{
stream.write ("\tshift_right\n");
}
/* shift_rright */
function JSC$ASM_shift_rright (ln)
{
this.type = JSC$OP_SHIFT_RRIGHT;
this.linenum = ln;
this.stack_delta = -1;
this.size = 1;
this.print = JSC$ASM_shift_rright_print;
this.link = JSC$asm_link;
}
function JSC$ASM_shift_rright_print (stream)
{
stream.write ("\tshift_rright\n");
}
/* iffalse */
function JSC$ASM_iffalse (ln, value)
{
this.type = JSC$OP_IFFALSE;
this.linenum = ln;
this.value = value;
this.stack_delta = -1;
this.size = 5;
this.print = JSC$ASM_iffalse_print;
this.bytecode = JSC$ASM_bytecode_local_jump;
this.link = JSC$asm_link;
}
function JSC$ASM_iffalse_print (stream)
{
stream.write ("\tiffalse\t\t" + this.value.format () + "\n");
}
/* iftrue */
function JSC$ASM_iftrue (ln, value)
{
this.type = JSC$OP_IFTRUE;
this.linenum = ln;
this.value = value;
this.stack_delta = -1;
this.size = 5;
this.print = JSC$ASM_iftrue_print;
this.bytecode = JSC$ASM_bytecode_local_jump;
this.link = JSC$asm_link;
}
function JSC$ASM_iftrue_print (stream)
{
stream.write ("\tiftrue\t\t" + this.value.format () + "\n");
}
/* call_method */
function JSC$ASM_call_method (ln, value)
{
this.type = JSC$OP_CALL_METHOD;
this.linenum = ln;
this.value = value;
this.stack_delta = 1;
this.size = 5;
this.print = JSC$ASM_call_method_print;
this.bytecode = JSC$ASM_bytecode_symbol;
this.link = JSC$asm_link;
}
function JSC$ASM_call_method_print (stream)
{
stream.write ("\tcall_method\t" + this.value + "\n");
}
/* jmp */
function JSC$ASM_jmp (ln, value)
{
this.type = JSC$OP_JMP;
this.linenum = ln;
this.value = value;
this.size = 5;
this.print = JSC$ASM_jmp_print;
this.bytecode = JSC$ASM_bytecode_local_jump;
this.link = JSC$asm_link;
}
function JSC$ASM_jmp_print (stream)
{
stream.write ("\tjmp\t\t" + this.value.format () + "\n");
}
/* jsr */
function JSC$ASM_jsr (ln)
{
this.type = JSC$OP_JSR;
this.linenum = ln;
this.stack_delta = 1;
this.size = 1;
this.print = JSC$ASM_jsr_print;
this.link = JSC$asm_link;
}
function JSC$ASM_jsr_print (stream)
{
stream.write ("\tjsr\n");
}
/* return */
function JSC$ASM_return (ln)
{
this.type = JSC$OP_RETURN;
this.linenum = ln;
this.size = 1;
this.print = JSC$ASM_return_print;
this.link = JSC$asm_link;
}
function JSC$ASM_return_print (stream)
{
stream.write ("\treturn\n");
}
/* typeof */
function JSC$ASM_typeof (ln)
{
this.type = JSC$OP_TYPEOF;
this.linenum = ln;
this.size = 1;
this.print = JSC$ASM_typeof_print;
this.link = JSC$asm_link;
}
function JSC$ASM_typeof_print (stream)
{
stream.write ("\ttypeof\n");
}
/* new */
function JSC$ASM_new (ln)
{
this.type = JSC$OP_NEW;
this.linenum = ln;
this.stack_delta = 1;
this.size = 1;
this.print = JSC$ASM_new_print;
this.link = JSC$asm_link;
}
function JSC$ASM_new_print (stream)
{
stream.write ("\tnew\n");
}
/* delete_property */
function JSC$ASM_delete_property (ln, value)
{
this.type = JSC$OP_DELETE_PROPERTY;
this.linenum = ln;
this.value = value;
this.size = 5;
this.print = JSC$ASM_delete_property_print;
this.bytecode = JSC$ASM_bytecode_symbol;
this.link = JSC$asm_link;
}
function JSC$ASM_delete_property_print (stream)
{
stream.write ("\tdelete_property\t" + this.value + "\n");
}
/* delete_array */
function JSC$ASM_delete_array (ln)
{
this.type = JSC$OP_DELETE_ARRAY;
this.linenum = ln;
this.stack_delta = -1;
this.size = 1;
this.print = JSC$ASM_delete_array_print;
this.link = JSC$asm_link;
}
function JSC$ASM_delete_array_print (stream)
{
stream.write ("\tdelete_array\n");
}
/* locals */
function JSC$ASM_locals (ln, value)
{
this.type = JSC$OP_LOCALS;
this.linenum = ln;
this.value = value;
this.stack_delta = value;
this.size = 3;
this.print = JSC$ASM_locals_print;
this.bytecode = JSC$ASM_bytecode_int16;
this.link = JSC$asm_link;
}
function JSC$ASM_locals_print (stream)
{
stream.write ("\tlocals\t\t" + this.value.toString () + "\n");
}
/* min_args */
function JSC$ASM_min_args (ln, value)
{
this.type = JSC$OP_MIN_ARGS;
this.linenum = ln;
this.value = value;
this.stack_delta = -1;
this.size = 2;
this.print = JSC$ASM_min_args_print;
this.bytecode = JSC$ASM_bytecode_int8;
this.link = JSC$asm_link;
}
function JSC$ASM_min_args_print (stream)
{
stream.write ("\tmin_args\t" + this.value.toString () + "\n");
}
/* load_nth_arg */
function JSC$ASM_load_nth_arg (ln)
{
this.type = JSC$OP_LOAD_NTH_ARG;
this.linenum = ln;
this.size = 1;
this.print = JSC$ASM_load_nth_arg_print;
this.link = JSC$asm_link;
}
function JSC$ASM_load_nth_arg_print (stream)
{
stream.write ("\tload_nth_arg\n");
}
/* with_push */
function JSC$ASM_with_push (ln)
{
this.type = JSC$OP_WITH_PUSH;
this.linenum = ln;
this.stack_delta = -1;
this.size = 1;
this.print = JSC$ASM_with_push_print;
this.link = JSC$asm_link;
}
function JSC$ASM_with_push_print (stream)
{
stream.write ("\twith_push\n");
}
/* with_pop */
function JSC$ASM_with_pop (ln, value)
{
this.type = JSC$OP_WITH_POP;
this.linenum = ln;
this.value = value;
this.size = 2;
this.print = JSC$ASM_with_pop_print;
this.bytecode = JSC$ASM_bytecode_int8;
this.link = JSC$asm_link;
}
function JSC$ASM_with_pop_print (stream)
{
stream.write ("\twith_pop\t" + this.value.toString () + "\n");
}
/* try_push */
function JSC$ASM_try_push (ln, value)
{
this.type = JSC$OP_TRY_PUSH;
this.linenum = ln;
this.value = value;
this.size = 5;
this.print = JSC$ASM_try_push_print;
this.bytecode = JSC$ASM_bytecode_local_jump;
this.link = JSC$asm_link;
}
function JSC$ASM_try_push_print (stream)
{
stream.write ("\ttry_push\t" + this.value.format () + "\n");
}
/* try_pop */
function JSC$ASM_try_pop (ln, value)
{
this.type = JSC$OP_TRY_POP;
this.linenum = ln;
this.value = value;
this.size = 2;
this.print = JSC$ASM_try_pop_print;
this.bytecode = JSC$ASM_bytecode_int8;
this.link = JSC$asm_link;
}
function JSC$ASM_try_pop_print (stream)
{
stream.write ("\ttry_pop\t\t" + this.value.toString () + "\n");
}
/* throw */
function JSC$ASM_throw (ln)
{
this.type = JSC$OP_THROW;
this.linenum = ln;
this.stack_delta = -1;
this.size = 1;
this.print = JSC$ASM_throw_print;
this.link = JSC$asm_link;
}
function JSC$ASM_throw_print (stream)
{
stream.write ("\tthrow\n");
}
/* iffalse_b */
function JSC$ASM_iffalse_b (ln, value)
{
this.type = JSC$OP_IFFALSE_B;
this.linenum = ln;
this.value = value;
this.stack_delta = -1;
this.size = 5;
this.print = JSC$ASM_iffalse_b_print;
this.bytecode = JSC$ASM_bytecode_local_jump;
this.link = JSC$asm_link;
}
function JSC$ASM_iffalse_b_print (stream)
{
stream.write ("\tiffalse_b\t" + this.value.format () + "\n");
}
/* iftrue */
function JSC$ASM_iftrue_b (ln, value)
{
this.type = JSC$OP_IFTRUE_B;
this.linenum = ln;
this.value = value;
this.stack_delta = -1;
this.size = 5;
this.print = JSC$ASM_iftrue_b_print;
this.bytecode = JSC$ASM_bytecode_local_jump;
this.link = JSC$asm_link;
}
function JSC$ASM_iftrue_b_print (stream)
{
stream.write ("\tiftrue_b\t" + this.value.format () + "\n");
}
/* add_1_i */
function JSC$ASM_add_1_i (ln)
{
this.type = JSC$OP_ADD_1_I;
this.linenum = ln;
this.size = 1;
this.print = JSC$ASM_add_1_i_print;
this.link = JSC$asm_link;
}
function JSC$ASM_add_1_i_print (stream)
{
stream.write ("\tadd_1_i\n");
}
/* add_2_i */
function JSC$ASM_add_2_i (ln)
{
this.type = JSC$OP_ADD_2_I;
this.linenum = ln;
this.size = 1;
this.print = JSC$ASM_add_2_i_print;
this.link = JSC$asm_link;
}
function JSC$ASM_add_2_i_print (stream)
{
stream.write ("\tadd_2_i\n");
}
/* load_global_w */
function JSC$ASM_load_global_w (ln, value)
{
this.type = JSC$OP_LOAD_GLOBAL_W;
this.linenum = ln;
this.value = value;
this.stack_delta = 1;
this.size = 5;
this.print = JSC$ASM_load_global_w_print;
this.bytecode = JSC$ASM_bytecode_symbol;
this.link = JSC$asm_link;
}
function JSC$ASM_load_global_w_print (stream)
{
stream.write ("\tload_global_w\t" + this.value + "\n");
}
/* jsr_w */
function JSC$ASM_jsr_w (ln, value)
{
this.type = JSC$OP_JSR_W;
this.linenum = ln;
this.value = value;
this.stack_delta = 1;
this.size = 5;
this.print = JSC$ASM_jsr_w_print;
this.bytecode = JSC$ASM_bytecode_symbol;
this.link = JSC$asm_link;
}
function JSC$ASM_jsr_w_print (stream)
{
stream.write ("\tjsr_w\t\t" + this.value + "\n");
}
/*
* General helpers.
*/
function JSC$asm_link ()
{
this.next = null;
if (JSC$asm_tail != null)
{
JSC$asm_tail_prev = JSC$asm_tail;
JSC$asm_tail.next = this;
}
else
JSC$asm_head = this;
JSC$asm_tail = this;
}
/*
* The phases of the assembler.
*/
/* This is called from the compiler initialization code. */
function JSC$asm_reset ()
{
JSC$asm_label_count = 1;
JSC$asm_head = JSC$asm_tail = JSC$asm_tail_prev = null;
JSC$asm_constcount = 0;
JSC$asm_constants = null;
JSC$asm_known_constants = null;
}
function JSC$asm_generate ()
{
var i;
if (JSC$verbose)
JSC$message ("jsc: generating assembler");
JSC$ns = new JSC$NameSpace ();
/* Functions. */
for (i = 0; i < JSC$functions.length; i++)
JSC$functions[i].asm ();
/* Global statements. */
if (JSC$global_stmts.length > 0)
{
/* Define the `.global' symbol. */
new JSC$ASM_symbol (JSC$global_stmts[0].linenum, ".global").link ();
/* Handle local variables. */
var num_locals = JSC$count_locals_from_stmt_list (JSC$global_stmts);
if (num_locals > 0)
new JSC$ASM_locals (JSC$global_stmts[0].linenum, num_locals).link ();
/* Generate assembler. */
for (i = 0; i < JSC$global_stmts.length; i++)
JSC$global_stmts[i].asm ();
/*
* Fix things so that also the global statement returns something
* (this is required when we use eval() in JavaScript).
*/
if (JSC$asm_tail_prev == null)
{
/* This is probably illegal, but we don't panic. */
new JSC$ASM_const_undefined (0).link ();
}
else
{
/*
* If the latest op is `pop', remove it. Otherwise, append
* a `const_undefined'.
*/
if (JSC$asm_tail.type == JSC$OP_POP)
{
JSC$asm_tail = JSC$asm_tail_prev;
JSC$asm_tail.next = null;
JSC$asm_tail_prev = null;
}
else
new JSC$ASM_const_undefined (JSC$asm_tail.linenum).link ();
}
}
JSC$ns = null;
}
function JSC$asm_print (src_stream, stream)
{
var i;
var last_ln;
var annotate = src_stream ? true : false;
if (annotate)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -