Browse Source

Merge branch 'wider-opcode-args'

pull/156/head
Sami Vaarala 10 years ago
parent
commit
8c97d28190
  1. 13
      src/duk_js_compiler.c
  2. 10
      src/duk_js_executor.c

13
src/duk_js_compiler.c

@ -3092,9 +3092,9 @@ DUK_LOCAL void duk__expr_nud(duk_compiler_ctx *comp_ctx, duk_ivalue *res) {
case DUK_TOK_THIS: {
duk_reg_t reg_temp;
reg_temp = DUK__ALLOCTEMP(comp_ctx);
duk__emit_extraop_b(comp_ctx,
DUK_EXTRAOP_LDTHIS | DUK__EMIT_FLAG_B_IS_TARGET,
(duk_regconst_t) reg_temp);
duk__emit_extraop_bc(comp_ctx,
DUK_EXTRAOP_LDTHIS,
(duk_regconst_t) reg_temp);
res->t = DUK_IVAL_PLAIN;
res->x1.t = DUK_ISPEC_REGCONST;
res->x1.regconst = (duk_regconst_t) reg_temp;
@ -5606,10 +5606,9 @@ DUK_LOCAL void duk__parse_throw_stmt(duk_compiler_ctx *comp_ctx, duk_ivalue *res
}
reg_val = duk__exprtop_toreg(comp_ctx, res, DUK__BP_FOR_EXPR /*rbp_flags*/);
duk__emit_extraop_b_c(comp_ctx,
DUK_EXTRAOP_THROW,
(duk_regconst_t) reg_val,
(duk_regconst_t) 0);
duk__emit_extraop_bc(comp_ctx,
DUK_EXTRAOP_THROW,
(duk_regconst_t) reg_val);
}
DUK_LOCAL void duk__parse_try_stmt(duk_compiler_ctx *comp_ctx, duk_ivalue *res) {

10
src/duk_js_executor.c

@ -3461,15 +3461,15 @@ DUK_INTERNAL void duk_js_execute_bytecode(duk_hthread *exec_thr) {
case DUK_EXTRAOP_LDTHIS: {
/* Note: 'this' may be bound to any value, not just an object */
duk_small_uint_fast_t b = DUK_DEC_B(ins);
duk_small_uint_fast_t bc = DUK_DEC_BC(ins);
duk_tval tv_tmp;
duk_tval *tv1, *tv2;
tv1 = DUK__REGP(b);
tv1 = DUK__REGP(bc);
tv2 = thr->valstack_bottom - 1; /* 'this binding' is just under bottom */
DUK_ASSERT(tv2 >= thr->valstack);
DUK_DDD(DUK_DDDPRINT("LDTHIS: %!T to r%ld", (duk_tval *) tv2, (long) b));
DUK_DDD(DUK_DDDPRINT("LDTHIS: %!T to r%ld", (duk_tval *) tv2, (long) bc));
DUK_TVAL_SET_TVAL(&tv_tmp, tv1);
DUK_TVAL_SET_TVAL(tv1, tv2);
@ -3892,14 +3892,14 @@ DUK_INTERNAL void duk_js_execute_bytecode(duk_hthread *exec_thr) {
case DUK_EXTRAOP_THROW: {
duk_context *ctx = (duk_context *) thr;
duk_small_uint_fast_t b = DUK_DEC_B(ins);
duk_small_uint_fast_t bc = DUK_DEC_BC(ins);
/* Note: errors are augmented when they are created, not
* when they are thrown. So, don't augment here, it would
* break re-throwing for instance.
*/
duk_dup(ctx, (duk_idx_t) b);
duk_dup(ctx, (duk_idx_t) bc);
DUK_DDD(DUK_DDDPRINT("THROW ERROR (BYTECODE): %!dT (before throw augment)",
(duk_tval *) duk_get_tval(ctx, -1)));
#if defined(DUK_USE_AUGMENT_ERROR_THROW)

Loading…
Cancel
Save